DllCall Produces Strange Error Code

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: DllCall Produces Strange Error Code

Re: DllCall Produces Strange Error Code

Post by 1100++ » 03 Jan 2020, 00:51

I think I've determined that the error code comes from the call to LoadLibrary() that I perform before calling the function; apparently, my call to GetProcAddress() afterward has no effect on the value.

Re: DllCall Produces Strange Error Code

Post by 1100++ » 03 Jan 2020, 00:24

Using SetLastError(0); inside one of the functions resulted in an A_LastError value of zero.
If I call SetLastError(n) before calling one of my functions, the value n is preserved through the function call.

Re: DllCall Produces Strange Error Code

Post by swagfag » 02 Jan 2020, 23:18

probably not. u can try calling SetLastError urself with some bogus value beforehand and check whether it remains the same throughout.

Re: DllCall Produces Strange Error Code

Post by 1100++ » 02 Jan 2020, 09:45

Could it be DllMain()? I just used the default version provided with the Visual Studio template.

Re: DllCall Produces Strange Error Code

Post by swagfag » 02 Jan 2020, 09:14

not necessarily, if ur functions dont call SetLastError what u are observing might be the remnants of previous winapi calls
or there might be something wrong with ur code, who knows

Re: DllCall Produces Strange Error Code

Post by tank » 02 Jan 2020, 07:14

Are you loadlibrary firs?

DllCall Produces Strange Error Code

Post by 1100++ » 02 Jan 2020, 06:46

In order to use C++ code within AutoHotkey, I've been writing the code into functions that I compile into DLLs with Visual Studio and call with DllCall(). However, while most of the functions work as expected and set ErrorLevel to 0 after being called, they always set A_LastError to 126—"The specified module could not be found." Is this something that I should be concerned about?

Top