Click on External App Button VB2010

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #64424
    imFiles
    Administrator

    How to click on an external app button 🙂 Just working on something and needed to save this code lol
    Delare

    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    Const WM_COMMAND As Integer = &H111S
    Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWndParent As IntPtr, ByVal hWndChildAfter As Integer, ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
    Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
    Private Const BM_CLICK = &HF5

    Call it with

    x = FindWindow("#32770", vbNullString)
    button = FindWindowEx(x, 0&, "button", vbNullString)
    button = FindWindowEx(x, button, "button", vbNullString)
    SendMessage(button, BM_CLICK, 1, 0)
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.