Public Declare Function CreateThread Lib "kernel32" Alias "CreateThread" (lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal dwStackSize As Long, lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long

MSDN "CreateThread":
lpThreadAttributes
Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpThreadAttributes is NULL, the handle cannot be inherited.
Windows NT: The lpSecurityDescriptor member of the structure specifies a security descriptor for the new thread. If lpThreadAttributes is NULL, the thread gets a default security descriptor.

dwStackSize
Specifies the initial commit size of the stack, in bytes. The system rounds this value to the nearest page. If this value is zero, or is smaller than the default commit size, the default is to use the same size as the calling thread. For more information, see Thread Stack Size.
lpStartAddress
Pointer to the application-defined function of type LPTHREAD_START_ROUTINE to be executed by the thread and represents the starting address of the thread. For more information on the thread function, see ThreadProc.
lpParameter
Specifies a single 32-bit parameter value passed to the thread.
dwCreationFlags
Specifies additional flags that control the creation of the thread. If the CREATE_SUSPENDED flag is specified, the thread is created in a suspended state, and will not run until the ResumeThread function is called. If this value is zero, the thread runs immediately after creation. At this time, no other values are supported.
lpThreadId
Pointer to a 32-bit variable that receives the thread identifier.
Windows NT: If this parameter is NULL, the thread identifier is not returned.

Be aware that Microsoft does not support the CreateThread API for VB 6. It does work fine in VB 5, but you may have trouble if you try to use it in VB 6. I have a sample that uses it, which I will send if you post an e-mail address, but you should only do this if you are using VB 5 (or just want to see the code).

Another note, when you are debugging a program that uses threads, you should never try to run in the debugger. It will cause VB to GPF. You should always compile to an EXE and then test the EXE.

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

I haven't had a chance to look at your example yet, but I didn't say that you couldn't use VB6 with CreateThread, just that Microsoft has changed the implementation of the threading model of VB with VB 6, and there are now major restrictions with using the CreateThread API. And, they officially say that they don't support the use of this API with VB 6 (which means they don't want to get any support calls if your programs keep blowing up)

If you read this KB article, there is also a link to an article by Dan Appleman which explains a lot of how Threads work in VB. The major limitation now is in the use of Callback functions. If you were to spawn threads that ran their course and just ended, then I don't think you will have a problem. However, if you want the thread to do something, then callback to the program when finished, or to return something, then you may have trouble.

Now, that said, I saw an article in the VB Programmers Journal back in October or November that was on creating threads in VB 6 in a completely different way. This would be worth researching.

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…

Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code.
This l…