oMBRa Posted November 1, 2008 Posted November 1, 2008 the return type of a dll call can be choose by me?, I mean can I use the one I want?
Andreik Posted November 1, 2008 Posted November 1, 2008 the return type of a dll call can be choose by me?, I mean can I use the one I want?I think that you cannot choose the returned type of a dll but you can change type of variable after DllCall.
BrettF Posted November 1, 2008 Posted November 1, 2008 It's all in the help file if you cared to take 30 seconds to read the page on DllCall. I suggest if you are not as far as the help file you cease and desist, cause if you add DllCalls, things become much harder. Syntax is: DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] ) 2nd parameter- The return type of the function. Returns string, Int, double, float, whatever takes your pick. Now we skip to an example. $hwnd = WinGetHandle("[CLASS:Notepad]") $result = DllCall("user32.dll", "int", "GetWindowText", "hwnd", $hwnd, "str", "", "int", 32768) msgbox(0, "", $result[0]) ; number of chars returned msgbox(0, "", $result[2]) ; Text returned in param 2 This returns a value specified in the return type... Overall, its a hard concept to grasp, so good luck. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Andreik Posted November 1, 2008 Posted November 1, 2008 It's all in the help file if you cared to take 30 seconds to read the page on DllCall. I suggest if you are not as far as the help file you cease and desist, cause if you add DllCalls, things become much harder. Syntax is: DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] ) 2nd parameter- The return type of the function. Returns string, Int, double, float, whatever takes your pick. Now we skip to an example. $hwnd = WinGetHandle("[CLASS:Notepad]") $result = DllCall("user32.dll", "int", "GetWindowText", "hwnd", $hwnd, "str", "", "int", 32768) msgbox(0, "", $result[0]) ; number of chars returned msgbox(0, "", $result[2]) ; Text returned in param 2 This returns a value specified in the return type... Overall, its a hard concept to grasp, so good luck. Cheers, BrettI understood that he want to know if it`s possible to choose returned type of DllCall. So the best method is to experiment. In this example if you change "int" with "str" then will get an error: $hwnd = WinGetHandle("[CLASS:Notepad]") $result = DllCall("user32.dll", "str", "GetWindowText", "hwnd", $hwnd, "str", "", "int", 32768) msgbox(0, "", $result[0]) ; number of chars returned msgbox(0, "", $result[2]) ; Text returned in param 2 But some type will work well like "byte"
BrettF Posted November 1, 2008 Posted November 1, 2008 I still have no idea what he really wants. Maybe he should post the dll and function and parameters + types ETC so we can better teach him. But as I found with BASS.dll the provided types sometimes lie Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Andreik Posted November 1, 2008 Posted November 1, 2008 I still have no idea what he really wants. Maybe he should post the dll and function and parameters + types ETC so we can better teach him. But as I found with BASS.dll the provided types sometimes lie I agree. He should post the dll so all will be more clearly.
oMBRa Posted November 1, 2008 Author Posted November 1, 2008 my question didnt regard a specific dll, it was only a general one, but nevermind I got it...
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