I was looking back into doing some CDECL calls, and tried this out. Surprisingly, it didn't work. The comments mention calling methods by ordinal, but I don't see a way to do that. One of Paul Caton's procedures had a simple solution:
Code:Private Declare Function GetProcByOrdinal Lib "kernel32" Alias "GetProcAddress" (ByVal hModule As Long, ByVal nOrdinal As Long) As Long . . If Left$(FunctionName, 1) = "#" Then fPtr = GetProcByOrdinal(hMod, CLng(Mid$(FunctionName, 2))) ' get the function pointer by ordinal # Else fPtr = GetProcAddress(hMod, FunctionName) ' get the function pointer (Case-Sensitive) End If




Reply With Quote