Jump to content
Sign in to follow this  
oMBRa

return type od Dll Call

Recommended Posts

oMBRa

the return type of a dll call can be choose by me?, I mean can I use the one I want?

Share this post


Link to post
Share on other sites
Andreik

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.


When the words fail... music speaks

Share this post


Link to post
Share on other sites
BrettF

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

Share this post


Link to post
Share on other sites
Andreik

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"


When the words fail... music speaks

Share this post


Link to post
Share on other sites
BrettF

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:

Share this post


Link to post
Share on other sites
Andreik

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:


When the words fail... music speaks

Share this post


Link to post
Share on other sites
oMBRa

my question didnt regard a specific dll, it was only a general one, but nevermind I got it...

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.