Closed lollita closed 8 years ago
what about x64 and x86?
Try to get last error code GetLastError
You have to load a module using LoadLibrary before you call GetModuleHandle. Following example works as expected.
require("/lib/Library.js");
var Kernel32 = new Library("Kernel32.dll");
var hhctrl = new Library("hhctrl.ocx");
Kernel32.Define("GetModuleHandleW", "LPCTSTR");
hModule=Kernel32.GetModuleHandleW("hhctrl.ocx")
alert(hModule);
why:
require(require.currentDir+"\lib\Library.js"); var Kernel32 = new Library("Kernel32.dll"); Kernel32.Define("GetModuleHandleW", "LPCTSTR"); hModule=Kernel32.GetModuleHandleW("hhctrl.ocx") alert(hModule);
return 0? no problem with f.e.: hModule=Kernel32.GetModuleHandleW("Kernel32.dll")