Sign in to follow this  
Followers 0
pipobona

Dllcall problem when converting from VB.NET to AutoIt functions

2 posts in this topic

Hey all,

I have tried to convert the following functions into autoitv3 :

Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" _
          (ByVal zero As IntPtr, ByVal windowName As String) As IntPtr 'vindt window

    Public Declare Function GetDlgItem Lib "user32.dll" _
        (ByVal hDlg As IntPtr, ByVal nIDDlgItem As Integer) As IntPtr 'get dialoog item, de control

    Public Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" _
           (ByVal hWnd As IntPtr, ByVal Msg As Integer, _
           ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean 'druk op enter voor post

    Public Declare Function GetMessage Lib "user32" Alias "SendMessageA" _
      (ByVal hWnd As IntPtr, ByVal Msg As Integer, _
      ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer 'ontvang

    Public Declare Function GetMessage Lib "user32" Alias "SendMessageA" _
        (ByVal hWnd As IntPtr, ByVal Msg As Integer, _
        ByVal wParam As IntPtr, ByVal lParam As System.Text.StringBuilder) As Integer 'ontvang 

    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
        (ByVal hWnd As IntPtr, ByVal Msg As Integer, _
        ByVal wParam As IntPtr, ByVal lParam As String) As Integer 'ontvang

Now I converted the first one and tried if it worked, but it didn't (the program was running and when i runned the function in VB.Net is worked properly)

:

$resulthwnd = DllCall("user32.dll", "int", "FindWindowA", "int", 0, "str", "GameData")

MsgBox(0,Int ( $resulthwnd ),Int( $resulthwnd ))

changing the int to int_ptr doesn't work either it only becomes worse, as the program doesn't want to start anymore.

Thanks in Advance...

Share this post


Link to post
Share on other sites



$resulthwnd is an array, so what you probably want is $resulthwnd[0].

That tripped me up the first time too.


BlueBearrOddly enough, this is what I do for fun.

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