MITH Posted October 9, 2014 Posted October 9, 2014 Hi, I am not able to get the four WinGetPos functions to work in VBA using the Autoit DLL. I get error stating "Cant find DLL Entry Point AU3_WinGetPosX in AutoitX3.dll" Here's my Code: Private Declare Function AU3_WinGetPosX Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As LongPtr, ByVal szText As LongPtr) As Long Private Declare Function AU3_WinGetPosY Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As LongPtr, ByVal szText As LongPtr) As Long Private Declare Function AU3_WinGetPosHeight Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As LongPtr, ByVal szText As LongPtr) As Long Private Declare Function AU3_WinGetPosWidth Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As LongPtr, ByVal szText As LongPtr) As Long Public Function WinGetPosX(szTitle As String, Optional szText As String = "") As Long WinGetPosX = AU3_WinGetPosX(StrPtr(szTitle), StrPtr(szText)) End Function Sub Test() msgbox WinGetPosX ("Untitled - Notepad") End Sub Requesting to help me please...
JohnOne Posted October 10, 2014 Posted October 10, 2014 Can you use any function at all? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MITH Posted October 10, 2014 Author Posted October 10, 2014 John, I am able to use most of the AutoIt DLL Functions except that return screen coordinates like the below ones: AU3_WinGetPosX AU3_WinGetPosY AU3_WinGetPosHeight AU3_WinGetPosWidth AU3_MouseGetPosX AU3_MouseGetPosY AU3_ControlGetPosX AU3_ControlGetPosY AU3_ControlGetPosHeight AU3_ControlGetPosWidth I am not sure what is causing this problem.
funkey Posted October 13, 2014 Posted October 13, 2014 This works for me: Private Declare Function AU3_WinGetPosX Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As Long, ByVal szText As Long) As Long Private Declare Function AU3_WinGetPosY Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As Long, ByVal szText As Long) As Long Private Declare Function AU3_WinGetPosHeight Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As Long, ByVal szText As Long) As Long Private Declare Function AU3_WinGetPosWidth Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As Long, ByVal szText As Long) As Long Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
MITH Posted October 13, 2014 Author Posted October 13, 2014 (edited) Hi Funkey, I tried the method you suggested, but still not working, same error again. Seems to be bug in the AutoItx3.dll which I am using or may be because I am using 32bit MS Office on 64bit Windows 7 - Not sure. Could you please tell me which version of AutoItx3.dll you are using. I will try with that version. My version is 3.3.12.0 Thanks. Edited October 13, 2014 by MITH
funkey Posted October 13, 2014 Posted October 13, 2014 Hello, I tried with AutoIt 3.3.8.1 on Win7 x64 with Office 2003. For me everything worked as expected. Maybe I have soon time to test with v3.3.12.0. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning.
MITH Posted October 14, 2014 Author Posted October 14, 2014 Hi I tried the code with AutoItX3.dll version 3.3.8.1 - works perfectly. I also tested the same code with version 3.3.10.2 but it does not work. Seems the bug started from versions later than 3.3.8.1. Hope this is fixed in next version. Thanks Funkey
MITH Posted October 15, 2014 Author Posted October 15, 2014 Hi I again need your help. It was not the bug. In AutoIt DLL Version 3.3.12.0. I find that the AU3_WinGetPosX, AU3_WinGetPosY, AU3_WinGetPosHeight and AU3_WinGetPosWidth functions are removed and a singe function AU3_WinGetPos has been added. But in new function there is third LPRect Argument which is now giving wrong coordinates. Below is my code using new function. The coordinates returned are 0. Please help me on this. Public Declare Function AU3_WinGetPos Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" _ (szTitle As LongPtr, szText As LongPtr, LPRect As LPRect) As Integer Type LPRect X As Integer Y As Integer Width As Integer Height As Integer End Type Sub Test() Dim LRect As LPRect, r As Integer, sT As String, sTx As String sT = "AutoItX Help" sTx = "" r = AU3_WinGetPos(StrPtr(sT), StrPtr(sTx), LRect) MsgBox LRect.X & " " & LRect.Y & " " & LRect.Width & " " & LRect.Height End Sub
wangzhengbo Posted October 16, 2014 Posted October 16, 2014 Hi I again need your help. It was not the bug. In AutoIt DLL Version 3.3.12.0. I find that the AU3_WinGetPosX, AU3_WinGetPosY, AU3_WinGetPosHeight and AU3_WinGetPosWidth functions are removed and a singe function AU3_WinGetPos has been added. But in new function there is third LPRect Argument which is now giving wrong coordinates. Below is my code using new function. The coordinates returned are 0. Please help me on this. Public Declare Function AU3_WinGetPos Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" _ (szTitle As LongPtr, szText As LongPtr, LPRect As LPRect) As Integer Type LPRect X As Integer Y As Integer Width As Integer Height As Integer End Type Sub Test() Dim LRect As LPRect, r As Integer, sT As String, sTx As String sT = "AutoItX Help" sTx = "" r = AU3_WinGetPos(StrPtr(sT), StrPtr(sTx), LRect) MsgBox LRect.X & " " & LRect.Y & " " & LRect.Width & " " & LRect.Height End Sub There is no problem with AU3_WinGetPos function. I'm using java, see https://code.google.com/p/jautoitx
Solution MITH Posted October 16, 2014 Author Solution Posted October 16, 2014 Solved: It was just the DLL calling convention that I should have followed. Public Declare Function AU3_WinGetPos Lib "C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.dll" _ (ByVal szTitle As LongPtr, ByVal szText As LongPtr, ByRef LPRect As LPRect) As Integer Type LPRect X As Integer Y As Integer Width As Integer Height As Integer End Type Sub Test() Dim LRect As LPRect, r As Integer, sT As String, sTx As String sT = "AutoItX Help" sTx = "" r = AU3_WinGetPos(StrPtr(sT), StrPtr(sTx), LRect) MsgBox LRect.X & " " & LRect.Y & " " & LRect.Width & " " & LRect.Height End Sub
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now