Sign in to follow this  
Followers 0
JustANoob

DllCall T_T

9 posts in this topic

Hi all, iam trying to call a dll using the method OpenDLL and DllCall and here how i call in VB.Net:

#how I import lib
<DllImport("MYDLL.DLL")> 
Public Shared Sub SR(ByVal Width As Integer, ByVal Height As Integer)


#some part of my code in VB.NET
        Dim num As Integer
        Dim height As Integer = num = 0
        If Me.rbRes1.Checked Then
            num = 640
            height = 480
        ElseIf Me.rbRes2.Checked Then
            num = 800
            height = 600
        ElseIf Me.rbRes3.Checked Then
            num = &H400
            height = &H300
        Else
            num = &H500
            height = &H400
        End If
        Imports.SR(num, height)

Now iam trying to call same function in AU3:

$dll = dllopen("C:mydll.dll")
DllCall ($dll, "none", "SR" , "1024", "768")

OR

$dll = dllopen("C:mydll.dll")
DllCall ($dll, "none", "SR" , 1024, 768)

OR

$dll = dllopen("C:mydll.dll")
DllCall ($dll, "none", "SR" , HEX(1024), HEX(768))

In vb.net works fine, but in AU3, even I call with 1024, 768 the function works in 640, 480. Any idea?

PS: I need use OpenDLL couse the function still running and rezise window when press hotkey.

Thanks.

Share this post


Link to post
Share on other sites



well, here is the function on the DLL: (C++)

HOOKDLL_API VOID SR(INT Width,INT Height)
{
    g_XRES = Width;
    g_YRES = Height;
}

How i call function now:

$return = DllCall ($dll , "ptr", "SR", "int", 1024, "int", 768)

OR

$return = DllCall ($dll , "none", "SR", "int", 1024, "int", 768)

And it just dont works =\

Share this post


Link to post
Share on other sites

o.O

Nobody knows if is an bug or anything else? Have another way to call this function?

Share this post


Link to post
Share on other sites

If @error Then _GetLastErrorMessage ("DllCall() error")

Yes =\

Have no error, just dont works. I can use ANY argument (like "aks", "jdja") and just return like 640,480.

I call it in VB.net and works fine....

T_T

Share this post


Link to post
Share on other sites

try this:

DllCall ($dll , "none:cdecl", "SR", "int", 1024, "int", 768)

$return = DllCall ($dll , "none:cdecl", "SR", "int", 1024, "int", 768)
DllCall ($dll, "none:cdecl", "IH")

Now its works. I try before, but I was using ":cdecl" only on the first function.

Thanks for help, I will test in my main script later (i hope it works, couse have almost 20.000 lines and if i got some error T_T).

Thanks Piccaso, if u need something just pm (lol... i dont think i can help u couse iam a little noob in auto 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  
Followers 0