I'm doing some multithreading work with apartment threads, and I make a call to the above and it fails every time; I think I have to make a call before I do this to enable it to work, any ideas guys?
Printable View
I'm doing some multithreading work with apartment threads, and I make a call to the above and it fails every time; I think I have to make a call before I do this to enable it to work, any ideas guys?
hmmm never used that call :(
You want Asynchronous threads?
I tend to use
Code:Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
I want an Apartment Model thread, to give the thread its own copy of data to stop it getting mixed up in other threads...
is it possible to pass parameters into the threaded fubctions?
CoInitialize
Initializes the COM library on the current apartment and identifies the concurrency model as single-thread apartment (STA). Applications must initialize the COM library before they can call COM library functions other than CoGetMalloc and memory allocation functions.
You must do this before you can call any of the other COM functions, Dan Appleman has an example on his site - I'll bundle it into a class for apartment threads and post it.