 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
jk7800
Joined: 06 Jan 2008 Posts: 40 Location: Gdi+ v1.1
|
Posted: Tue Jul 22, 2008 12:30 pm Post subject: Problem with GetModuleHandle. |
|
|
Hi.
I was trying to change change the actual cursor to the one, located in an exe file. But I have problem with getting the module handle of my app. For instance: when I call
| Code: | h:=DllCall("GetModuleHandle", Str, "AutoHotkey.exe")
msgbox % DllCall( "GetLastError") |
in the AutoHotkey folder, it returns 0 (no errors). But if I copy the autohotkey.exe and rename it to autohotkey2.exe, the following script returns 126, meaning: "Module Not Found".
| Code: | h:=DllCall("GetModuleHandle", Str, "AutoHotkey2.exe")
msgbox % DllCall( "GetLastError") |
And it doesn't work... Why is it happening? |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Tue Jul 22, 2008 3:36 pm Post subject: |
|
|
| MSDN wrote: |
Retrieves a module handle for the specified module. The module must have been loaded by the calling process.
|
AFAIK, this means you need to run the exe to get it's handle, or in the case of a dll, use LoadLibrary.
Since autohotkey.exe is running (since your script is running) it returns something. Autohotkey2.exe is not running, so you get an error. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|