Vano Posted July 11, 2007 Share Posted July 11, 2007 (edited) I'm using autoit to call functions from my custom DLL.But when calling functions that return Integers, i always get zeros.I can actually see (in debugger) that the DLL returns integer 1 (and it gets stored in autoit's memory)but the script keeps displaying 0's or empty strings.I tries the same with a system DLL and got the same result!Here's an example script:MSGBox(0,"", DllCall("kernel32.dll", "int", "GetCurrentProcess")) MsgBox(0,"",@error)The same thing if i use 'long' or 'dword' or 'hwnd' instead of 'int'Looks like is the same problem as Formatting API return result creates problems, Fixed 3.2.3.7version 3.2.4.9 Edited July 11, 2007 by Vano Link to comment Share on other sites More sharing options...
Developers Jos Posted July 11, 2007 Developers Share Posted July 11, 2007 (edited) Please post questions like this in the Supportforum first to ensure its not a pilot error DllCall returns an Array thus indeed will show nothing when used in a MsgBox() Also the Second MsgBox() shos the @error generated by the first MsgBox() NOT the DllCall ! If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified). $return[0] = function return value $return[1] = param1 $return[2] = param2 ... $return[n] = paramn Edited July 11, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Vano Posted July 11, 2007 Author Share Posted July 11, 2007 If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified). $return[0] = function return value ...Dammit. I've read the article for many times but somehow missed this very paragraph Link to comment Share on other sites More sharing options...
ChrisL Posted July 11, 2007 Share Posted July 11, 2007 Dammit. I've read the article for many times but somehow missed this very paragraph $ret = DllCall("kernel32.dll", "int", "GetCurrentProcess") Msgbox(0,"",$ret[0]) Returns -1 $ret = DllCall("kernel32.dll", "hwnd", "GetCurrentProcess") Msgbox(0,"",$ret[0]) Returns a handle [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Vano Posted July 11, 2007 Author Share Posted July 11, 2007 DllCall returns an Array thus indeed will show nothing when used in a MsgBox() Also the Second MsgBox() shos the @error generated by the first MsgBox() NOT the DllCall !That's quite strange, however. If a variable contains a non-empty value, it should also evaluate to something non-empty when converted to string. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 11, 2007 Developers Share Posted July 11, 2007 That's quite strange, however. If a variable contains a non-empty value, it should also evaluate to something non-empty when converted to string.No it is not ... any array variable will return EMPTY when referred to without the [x] behind it .... Moving this thread to Support .... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now