To use thread in programming in vb6

The only “legal” way to do multi-threading in VB6 is through ActiveX EXEs — just use the thread per object option on the project properties dialog. Matt Curland has a good example how to convert your Standard EXE to a multi-threaded ActiveX EXE. Doing it this way allows VB6 debugger to works w/o crashes because in the IDE everything is executed on a single thread.

If you want to cut down the overhead of ActiveX EXE multi-threading then you have to use in-proc multi-threading which is not supported but still doable. Check Compact In-Process Multi-threading: A FolderWatcher with sample UI for a way to safely use CreateThread and to safely initialize VB6 run-time on the new thread (courtesy Matt Curland again).

You might want to check his Advanced Visual Basic 6 book for more details.

Leave a Comment