Code: Select all
handle = GetModuleHandle_("user32.dll")
Debug GetProcAddress_(handle, "MessageBoxA")
Code: Select all
handle = GetModuleHandle_("user32.dll")
Debug GetProcAddress_(handle, "MessageBoxA")
Code: Select all
a.f = #MB_ICONWARNING
MessageBox_(0,"test","test",a)
But PB uses MsgBoxW! There is no GetProcAddressW!codeprof wrote: PureBasic automatically convert the strings to pointers and it even converts float to integer...
Code: Select all
Import "kernel32.lib"
GetProcAddress_(handle.l, string.p-ascii) As "_GetProcAddress@8"
EndImport
;Test it
handle = GetModuleHandle_("user32.dll")
Debug GetProcAddress_(handle, "MessageBoxA")
Code: Select all
Name_funcA.s = Space(#MAX_PATH) ; Ascii
handle = GetModuleHandle_("user32.dll")
If handle
CompilerIf #PB_Compiler_Unicode
WideCharToMultiByte_(#CP_ACP, 0, @"MessageBoxA", -1, @Name_funcA, #MAX_PATH, #Null, #Null)
Debug Hex(GetProcAddress_(handle, Name_funcA))
CompilerElse
Debug Hex(GetProcAddress_(handle, "MessageBoxA"))
CompilerEndIf
EndIf