Jump to content

Recommended Posts

Posted

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.

Posted

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... :mellow:

Overall, its a hard concept to grasp, so good luck.

Cheers,

Brett

Posted

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... :mellow:

Overall, its a hard concept to grasp, so good luck.

Cheers,

Brett

I 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"

Posted

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 :mellow:

Posted

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. :mellow:

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...