Jump to content
Sign in to follow this  
lcloki

CallDLL

Recommended Posts

lcloki

Does anybody know why that's not working?

The function normally should return "ä". I also tried it with the Unicode version, but same result.

Dim $str1
    Dim $str2
    
    $str1=''
    $str2=''
    
    $res = DllCall( "user32.dll", "int", "OemToCharA", _
                    "str", $str1, _
                    "str", $str2)

    MsgBox(0, "", "error: " & @error & @CRLF _
                & "res: " & $res & @CRLF _
                & "str1: " & $str1 & @CRLF _
                & "str2: " & $str2)

OemToChar Windows API (MSDN Lib)

Share this post


Link to post
Share on other sites
GaryFrost

Dim $str1
    Dim $str2
    
    $str1=''
    $str2=''
    
    $res = DllCall( "user32.dll", "int", "OemToChar", _
                    "str", $str1, _
                    "str", $str2)

    MsgBox(0, "", "error: " & @error & @CRLF _
                & "res: " & $res[0] & @CRLF _
                & "str1: " & $res[1] & @CRLF _
                & "str2: " & $res[2])


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
lcloki

Okay, that worked! Thanks a lot, but can you explain why i have to search the result in res[0-2]? I don't understand it...

Share this post


Link to post
Share on other sites
GaryFrost

from the help file

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

you don't have to search, the function i helped you with will always place the value your looking for in $res[2] Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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.