Think I got a grasp on this, I took working code and converted this for a sample, anyone find anything wrong with this?
Scott
-------------
Scott
mailto:[email protected][email protected]</A>
Scott
Code:
#Compile Exe #Dim All #Option Version4 #Register None #Include "Win32api.inc" Declare Function ProcessMyFunction(DLvar1 As Long, var2 As String) As Long Declare Function MyFunction Lib "MY.DLL"(var1 As Long, var2 As String) As Long Function PbMain() As Long Local wUser As String wUser = "UserName:" 'These variables are ONLY samples, don't even have to be there 'If they don't change, set them in ProcessMyFunction as local variables 'vs passing them through the "Thunk" type DLL. If IsTrue ProcessMyFunction(SizeOf(wUser), wUser) Then MsgBox "It worked!!", %MB_ICONINFORMATION,"Wahoooo!" Else MsgBox "It didn't work, sorry charlie..", %MB_ICONINFORMATION,":(" End If End Function '=================================================================================== Function ProcessMyFunction(var1 As Long, var2 As String) As Long Local hLib As Long Local procAddr As Dword hLib = LoadLibrary("MY.DLL") 'Where "MYFUNCTION" is the function name in the DLL, IN UPPER CASE! procaddr = GetProcAddress(hLib,"MYFUNCTION") If ProcAddr = %NULL Then 'Failed to find the function. Do Msgbox or error out MsgBox "Failed to find function MYFUNCTION in MY.DLL" , %MB_ICONSTOP, "Error, failed to find procedure" Exit Function ' Function is already false here Else 'Found the function, process it now Call Dword ProcAddr Using MyFunction(var1,var2) 'Adjust function input accordingly, may have ot pass variables Function = %TRUE 'or a return from the function itself, suggestions? End If End Function
-------------
Scott
mailto:[email protected][email protected]</A>
Comment