views:

82

answers:

4

If so, does anyone know a good tutorial for it?

+3  A: 

You can in theory, but it is not pretty and its more like simulation than actual multithreading.

Easy multithread in VB (Updated) http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=31786&lngWId=1

Easy, Safe Multithreading in Vb6 with Low Overhead - Part 2 http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=24747&lngWId=1

kyndigs
+4  A: 

If you can get hold of a copy of Advanced Visual Basic 6: Power Techniques for Everyday Programs by Matthew Curland, there was a significant number of pages explaining how to do multi-threading in VB6.

You can also view the book online on Scribd:

Advanced Visual Basic 6 Power Techniques for Everyday Programs - Scribd

Chapter 13 is the chapter on VB6 threading.

Kev
+1 excellent book if you have the need for such things. I used it as the basis for a VB6 multithreaded image processing app that ran as a win service back in the day. It was tricky to get it working, but was stable once we got things ironed out.
drventure
A: 

If you want to go the commercial solution route, Desaware's SpyWorks contains a solution for creating threads in VB6.

http://desaware.com/products/universalcom/spyworks/features.aspx

Joe
+3  A: 

Related question: http://stackoverflow.com/questions/383162/to-use-thread-in-programming-in-vb6

Threading tutorial on VB6: http://www.freevbcode.com/ShowCode.Asp?ID=1287#The CreateThread API

Note that much of the tutorial above is about just how dangerous it is to actually use CreateThread in VB6; VB6 will not hold your hand to prevent you from doing something really dangerous and smashing your program, because VB6 is oblivious to threads. In fact, the author's goal is to scare you aware from threading in VB6 because of how much stuff you can mess up with it.

Much safer to just use ActiveX EXEs in separate threads. VB6 does support this. See related question for discussion of this.

Brian
+1 ActiveX Exe approach has a lot to recommend it. Shameless plug: I wrote about it in this answer to another threading question. http://stackoverflow.com/questions/727386/making-a-c-kill-event-for-a-vb6-app/752841#752841
MarkJ