Notice to function:I think if we can have a module function which can tell whether a thread in which we want to do any work is initialized in terms of runtime like isRunTimeinitialized which returns true or false it can be of help in simple MTA library example.Please clarify.
Code:' // Init thread and call function ' // This function is useful for callback of WINAPI functions which can call function in arbitrary thread Public Function InitCurrentThreadAndCallFunction( _ ByVal pfnCallback As Long, _ ByVal pParam As Long, _ ByRef lReturnValue As Long) As Boolean . . . If lTlsSlot Then ' // Check if thread already initialized pThreadData = TlsGetValue(lTlsSlot) If pThreadData <> 0 Then ' // Just call by pointer hr = DispCallFunc(ByVal 0&, pfnCallback, CC_STDCALL, vbLong, 1, vbLong, VarPtr(CVar(pParam)), vRet) . . . End If End If . . . End Function
ADDED:
You can't write a MTA library using this module. Moreover you can't write MTA library using any other module. To write a MTA library you need to programming only in the procedural style, considers restrictions of uninitialized runtime (like using APIs declared in a typelib). Also you need to ensure manually data synchronization (because you use MTA), manually vTable creation, manually registration, etc.
I can write such library but i don't want because it has no sense. I've already written the kernel driver to prove vb6 can do it. The same with MTA library. Maybe sometime i'll write such library![]()




Reply With Quote