Quote Originally Posted by smkperu View Post
Hello Trick,

How to call a third party vb6 standard dll exported function using Declare statement
or LoadLibrary/GetProcAddress in a vb6 standard exe.Here I cannot make the following code from modDllInitialize.bas of DllMain() run automatically in this third party dll since the dll is third party dll (ie., .dll without source code).

Code:
Case DLL_PROCESS_ATTACH
        
        If VBDll.UserDllMain(mhInstance, 0, hinstDLL, fdwReason, lpvReserved) = 0 Then
            GoTo CleanUp
        End If

        mlTlsSlot = VBDll.TlsAlloc()
        If mlTlsSlot = TLS_OUT_OF_INDEXES Then GoTo CleanUp
        
        DllMain = InitializeRuntimeForProject(hinstDLL, True) And 1

Thanks

Dear smkperu,

The following is the code which you have to use to call any exported function of your 3rd party standard dll without restrictions in your vb6 standard exe.




Code:
Dim tClsId      As tCurGUID
Dim tIID        As tCurGUID
Dim  dllhinstance   As long
Dim vbhdr as long

    dllhinstance = LoadLibrary("full path of third party dll") 
        
    vbhdr = SearchForVbHeader(dllhinstance) 'getvbheader
   
    'get IID_IUnknown
    tIID.c2 = 504403158265495.5712@
    
    ' init runtime
    VBDll.VBDllGetClassObject dllhinstance , 0, vbhdr , tClsId, tIID, 0 

    'call any exported function of the third party dll which  you have already declared using Declare statement.
regards,

JSVenu