MITH

AU3_DLL ControlMove Functions makes controls disappear

1 post in this topic

Hi,

I am trying to use ControlMove function AU3 DLL in VBA. The function instead of moving the control just makes it disappear. It only appears when I resize notepad manually.

Can anybody please help me and let me know whats the miss here

Here's the code I am working on:

Private Declare PtrSafe Function AU3_ControlMove Lib "C:\Program Files\AutoIt3\AutoItX\AutoItX3.dll" (ByVal szTitle As LongPtr, ByVal szText As LongPtr, ByVal szControl As LongPtr, ByVal nX As Integer, ByVal nY As Integer, nWidth As Integer, nHeight As Integer) As Long

Private Function ControlMove(szTitle As String, szControl As String, nX As Integer, nY As Integer, Optional nWidth As Integer = -1, Optional nHeight As Integer = -1, Optional szText As String = "") As Long
ControlMove = AU3_ControlMove(StrPtr(szTitle), StrPtr(szText), StrPtr(szControl), nX, nY, nWidth, nHeight)
End Function

Sub test()

ControlMove "Untitled - Notepad", "[CLASS:Edit; INSTANCE:1]", 0, 0, 150, 150

End Sub

The Edit Box in Notepad just disappears.

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

  • Similar Content

    • GTAVLover
      By GTAVLover
      I recently tried to use ControlClick method to send a mouse click command to a button in a application, but I noticed that it is not working when I give first parameter as a window handle (HWND). But, when I give class name or window title, it works fine. I used AutoItX3 and VBScript. 
      Following are the commands I tried in VBScript:
      Dim WINAPI: Set WINAPI = WScript.CreateObject("WinAPIWrapper.WINAPI") Dim AutoItX3: Set AutoItX3 = WScript.CreateObject("AutoItX3.Control") Dim WindowHandle: WindowHandle = WINAPI.WinAPI_FindWindow("my window title", "my window class") 'Window handle obtains fine by my wrapper function 'Above window handle is obtained as a hexadecimal string. (I.E. - 0x00000000) I tried it like: WScript.Echo CStr(AutoItX3.ControlClick(WindowHandle, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(CLng("&h" + Replace(WindowHandle, "0x", "")), "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(000000, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK WScript.Echo CStr(AutoItX3.ControlClick(0x00000000, "", "[CLASS:Button; INSTANCE:1]")) // DOES NOT WORK Only following commands work: WScript.Echo CStr(AutoItX3.ControlClick("[CLASS:my window class]", "", "[CLASS:Button; INSTANCE:1]")) // WORKS FINE WScript.Echo CStr(AutoItX3.ControlClick("My window title", "", "[CLASS:Button; INSTANCE:1]")) // WORKS FINE  
      If any of your suggestions don't work, I will have to write a wrapper function myself to send mouse click commands. I chosen AutoIt V3 because it is good specially when comes to send keystrokes to applications. Please tell me why this won't work when I give window handle as first parameter.
      Thanks in advance.
    • Yash91
      By Yash91
      Hi Experts,
      I want to integrate AutoIT with Eclipse to write my code in java for automating the desktop base application, i have integrate jacob 1.18 and verify the dll's also but i am getting How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51 issue.
      I am using 32 bit windows xp with java 1.6 version.
      Java 1.7 is unsupported in 32 bit windows xp. is there any solution for the same.
    • YashShrivastava
      By YashShrivastava
      Hi Experts,
      I am getting error: _ExcelBookOpen() undefined function in auto IT scite whenever i execute any program using functions.
      i defined the functions name also but this error is not getting resolved.
      _ExcelBookOpen(): undefined function
      _ExcelReadCell():undefined function
      require your inputs to fix this issue. I'm going through the forums and examples, but can't find anything and follow the suggestions but this issue hasn't got resolved.
       
    • srini
      By srini
      I am trying to automate the windows GUI application, in the main window of this application i have one gridview control in it, and when you click on the any row of the gridview separate windows will be opened based on the selection of the row. 
      we have our existing framework implemented using the core java,  i have used AutoITX4java.jar file to automate the above application. and controlCommandListView options used to click on grid view row item. nothing is working. 
      my question is AutoIT can be used/called directly from java file??? instead of using the AutoITX4java.jar file???
      AutoIT supports GridView automation??? like gridview count and gridivew row item click event automation ect...????
      Any help would be really appricate!!
      Thanks
      Srini
      srini20483@gmail.com
       
    • afzalw
      By afzalw
      I am using Autoit to automate another software.  I am looking to create a piece of code which can select the option from a combo box.  I know what option I want to select and I have stored it in a string but nothing seems to be working for me. 
      I am able to click on the Control by using this code.
      ControlClick("Import/Export Table Name", "","[NAME:cmbTableName]"); This is what I was thinking but doesn't work for me.
      ControlCommand("Import/Export Table Name", "", "[NAME:cmbTableName]", "SelectString", $MyOptionName)  
      If it helps: The option name that I want to select is also stored in clipboard.
      Any comments on what am I missing here will be appreciated.
      Thanks