Dear Trick,

I have gone thru your examples in code bank regarding multithreading.

When we want to call an exported function of an activex dll we can intialize the runtime
using the following code in DllMain() (code from modMainDLL.bas of GraphicsDLL project) and works perfectly.

Code:

If fdwReason = DLL_PROCESS_ATTACH Then

lpProc = GetProcAddress(hInstDll, "DllGetClassObject")
If lpProc = 0 Then Exit Function
GetMem4 ByVal lpProc + 2, lpVBHdr
GetMem4 ByVal lpProc + 7, lpUnk
GetMem4 ByVal lpProc + 12, lpInst
InitRuntime = UserDllMain(lpInst, lpUnk, hInstDll, fdwReason, ByVal lpvReserved)
If InitRuntime Then
vbCoInitialize ByVal 0&
iid.data4(0) = &HC0: iid.data4(7) = &H46 ' IUnknown
VBDllGetClassObject lpInst, lpUnk, lpVBHdr, clsid, iid, 0 ' Èíèöèàëèçàöèÿ ïîòîêà
End If
lpInst_ = lpInst: lpUnk_ = lpUnk: lpVBHdr_ = lpVBHdr: hInstance = hInstDll



But when I use the same code to initialize the runtime thru DllMain() for calling a exported function in a
standard dll just like the callbackdll in vbmultithreadingmodule callback example provided by you in "multithreading without dependencies" it fails.Please clarify what are the changes I have to do in DLLMain() for initializing the runtime properly in the standard dll.

regards,
JSVenu