Jump to content

return type od Dll Call


oMBRa
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...