Skip to content

Click on External App Button VB2010

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #186506
    Admin
    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)
    #186510
    Chike
    Member

    What external app window exactly?

    Serching the button by it’s control id would probably be better  and send the main window WM_COMMAND instead the BM_CLICK to the button.

    Are you on Windows 7 or XP? I think there may be some hidden #32770 class windows

    #186509
    Admin
    Administrator

    I using Windows 8.1 I’m finally install VB 2010 hehehe So I can program in my Newer PC. I was trying to click on the Settings on Paltalk on the Banner tab, this the pic
    Slice 1
    I was thinking about activating the button then clicking it to take off the banner 🙂 Kindna crazy Idea I had in my mind 😆

    #186508
    Chike
    Member

    Well boith are controls with unique ID so easy to find with the same methid we use to find room controls.

    Make sure you get the right controls by checking their text.

    Then you can try to enable them and do whatever.

     

    #186507
    Admin
    Administrator

    Yea, I’m going to check it in the future :mrgreen: when i go back to the project. Thanks

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.