|
-
Jan 5th, 2002, 09:43 PM
#1
Thread Starter
Lively Member
"Multithreading" in VB
I am working on a small app that pings servers to determine if they are "live" on the network. When the PING responds, a treeview is updated with the server being shown as red or green (green being up; red being down).
Problem is that my app is only able to execute for one server at a time. Fine for a couple of machines. But when I get up to 200-300 servers, this will be an issue.
I need a way to create an outside object (i.e. ActiveX EXE) that does the dirty work and responds to the host app with the status (Red or Green). This way the main app is only responsible for executing the outside object and maintaining the GUI. The external object gets the hard work...
Also, in this situation... how do I manage 50+ instances of a single object?
Does anyone have any sample code that I can look thru for Raising Events and/or managing object arrays or something that would fix my problem?
Thanks in advance!
Kevin
-
Jan 5th, 2002, 09:43 PM
#2
You can not Multithreading in vb .
-
Jan 5th, 2002, 09:46 PM
#3
Member
Originally posted by DaoK
You can not Multithreading in vb .
Sort of. For standard EXEs you can only multithread in the IDE which makes it pretty worthless. I believe it was Joacim who said that you could use either an ActiveX EXE or an ActiveX DLL to do much cleaner multithreading. Either way VB isn't good for it; if it is mission critical then use another language, especially Java which is incredibly easy to multithread in.
-
Jan 5th, 2002, 09:52 PM
#4
Originally posted by DaoK
You can not Multithreading in vb .
Actually this is not really true.
VB use an "Apartement Threading" module.
Since ksutton is using an ActiveX Exe you have a "free thread" for every instance of this object.
The problem is that you can't use the WithEvents keyword with object arrays which is what he wants to do.
I don't have a solution for the problem though, I just wanted to make this point clear (which from reading your post, ksutton, I suspect you know already)
Best regards
-
Jan 5th, 2002, 10:15 PM
#5
This is theory,
Create a Active X EXE. The main class is what you call and get events from. The main class in turn, creates an array of other classes in the EXE. Instead of getting events from them, it could just pole their properties by using the Friend property let, and get statements (maybe a continuous loop on a timer). It could report back progress and what nots to the client through it's event passing an object number, status, etc.
Just a thought, but the only problem with this is that all objects are still on the same thread of execution. But it will be seperate from the client thread.
Think that could work? Or do I need to go to sleep now?
-
Jan 29th, 2002, 09:24 PM
#6
Lively Member
you can multi-thread in vb, you just have to be tricky about it.
http://vbaccelerator.com/codelib/thread/exethr.htm
Um americano que fala portugues.
-
Jan 29th, 2002, 10:27 PM
#7
Cos you've got the activex exe already, you just need to catch the events from an object array - have a look ad Edanmo's page - he has a good example of just how this is done
www.domaindlx.com/e_morcillo
- gaffa
-
Jan 29th, 2002, 11:12 PM
#8
Dazed Member
Why don't you just wait 10 days, buy Visual Basic .net and then you can do all the multithreading you want!
-
Jan 30th, 2002, 02:01 AM
#9
Doing asynchronous processing even with callbacks isn't difficult at all, just check out the coffee example from MSDN. It gives you a perfect model to use. Or even search this forum and I bet you'll find more stuff on the subject.
The coffee example is the key though.
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
|