Click to See Complete Forum and Search --> : Concurrent Processes in VB


September 28th, 1999, 04:49 AM
I have a question! Is it possible to program a concurrent process within VB which will execute in the back ground
of a VB form constantly monitoring for updates in a field. This concurrent process does not necessarily
have to be written in VB itself. Is this possible?

Cheers

Chris Eastwood
September 28th, 1999, 03:21 PM
You could just use a Timer control in VB to handle this - simply place a timer on the form whose values you wish to check, then set the interval and write the code in the timer event to check those fields.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

September 29th, 1999, 05:12 AM
I need the SQL Server to notify the VB Clients in real time of any changes and therefore timer type polling will not do. The process has to be continous. I believe spawning a continous thread in VB is not the best way. Do you have any suggestions on how to achieve such a goal? (I have heard of two technologies so far DCOM + MTS or Extended Stored Procedures + ActiveX)

Cheers for you help

Muthu Ram
September 30th, 1999, 05:03 PM
how do you create a thread in vb? i guess if i'm not wrong that is what you are asking? if you find out a way to run concurrent process please post it here.

Chris Eastwood
October 1st, 1999, 02:28 AM
The article at :

http://codeguru.developer.com/vb/articles/1771.shtml

contains code that shows how to create a thread under visual basic. Be warned though that VB isn't really designed to use the CreateThread api calls and there's a lot of work (and crashing ) to get the routines working properly (although the example manages it, just be careful when hacking out the code).

You could, alternatively, create an ActiveX EXE that runs out-of-process to handle your background processes.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Lothar Haensler
October 1st, 1999, 02:46 AM
are you sure this is the right URL? the article deals with registering components. I didn't see any Thread code.
Am I blind?

Chris Eastwood
October 1st, 1999, 04:20 AM
The thread code is deep within the actual source of the downloadable project. The program doesn't use the 'RegSvr32' program, instead it creates a separate process to register the component using the API.



Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Muthu Ram
October 1st, 1999, 11:35 AM
out of process will not work. i need to stop a api function call in the middle of execution, if it takes too long to complete.

timer does not work. the stupid control waits patiently until the function returns. i dont know what use is this timer control for? if i set the interval to 5sec should not the timer event be fired at 5 sec?

i am planning to execute this timer in a background thread, that way i can be sure the timer event will be fired regularly.