|
-
January 28th, 1999, 04:12 AM
#1
How to create a new thread in VB
I have a client and a seperate server (activeX exe set to unattended execution).
I want to be able to terminate the server while it's running.
I invoke a Jam method that runs an infinite loop, and I want to be able to press a stop button that terminates the server. So far, when I call the server I can't access the client anymore!
What do I do?
-
February 10th, 1999, 11:09 PM
#2
Re: How to create a new thread in VB
Termination of automation server are control the COM object reference count. If you have only one client connect to it and your client has finished using the automation server, the automation server should be exited automatically.
If you have the automation server running in a infinite loop waiting for messages. You can exit the loop (and it is running in local mode) by adding a WaitForSingleObject api call on an Event object into your loop like below:
while WaitForSingleObject(hShutdown, 0) = 0 (psuedo code)
' Do something
wend
And on your client side have the shutdown button do the following:
SetEvent(hShutdown)
Then your server should be able to know that the client has instructed it to exit the infinite loop...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|