General information
Category:
Object Oriented Programming
Christof,
First, my motivation was simple, I want a "Cancel" button to be responsive during long processes (long meaning > 20 seconds up to n hours).
>Haven't tried that myself, but if you make an EXE server, it should run in a separate process. <
Yes, but it doesn't serve the purpose. Consider a job coded in MyClass.DoTheJob, it doesn't matter if you build it into a DLL or EXE, when you say oMyObject = createobject("mydll|myexe.MyClass"), and then oMyObject.DoTheJob execution waits until the "DoTheJob" method has finished. If this is activated by a button on a form, then you can't have another "Cancel" button on the form because the form is not responding to user input.
> There you can start a timer when a method is called and return immediately. The timer would fire a millisecond later and can actually do the job.
>
This is the approach in the Pool Manager server sample which I finally found buried in the MSDN directory. It seems to work OK, and best of all, you don't need to build a COM server (though you very easily can later). All you need is a top level form (showWindow = 2) with the timer and a couple of stock methods and properties to communicate with the calling form. So I built a class based on the "Job" class in the Pool Manager sample, threw in some stuff to respond to cancel requests, and it's working like a charm.
Thanks for the response, working largely on my own here it's always nice to confer and see that another programmer would pick the same route.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only