Hi everyone...

Iam new to VB, i want to know whether we have thread option in VB if so how can v implement that(Sample codes are appreciated). Right now iam using sleep but that ll not make it effecient so i need to implement thread concept...

Scenerio:

Iam working in setup creation using VB6, in that i need to invoke certain exe files by clicking Install CommandButton. After installing, the commandbutton should be disabled and UnInstall CommandButton should enabled. Moreover 2 or more exe files may invoke by a single click, thats y i think to call thread for each exe....

Will it work? How can i solve this??

Thanks in advance... Sample codes are appreciated...

Iam working in setup creation using VB6

I take it you're trying to write a program that will install or setup your program? That's pretty difficult to achieve with vb6 language alone and probably the easiest route is to use some Window APIs to achieve your goals.

Use the ShellExecuteEx API and extract the process handle for the exe that you wish to run.

Use the WaitForSingleObject API on that process handle.

And then use the CloseHandle API to close the handle

Yes you can use threads in VB but it is not advised. Here is a link to a simple example of using threads in vb by strongm from the http://www.tek-tips.com community.

http://www.tek-tips.com/viewthread.cfm?qid=519374

Look for strongm's post/example that starts with the evil laugh.

As for hkdani's posts, I would suggest that you use either of those suggestions long before you resort to threads in classic vb.

Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.