Home > Software engineering > VB control another program, click simulation application any button menu bar, in the pop-up drop-dow
VB control another program, click simulation application any button menu bar, in the pop-up drop-dow
Time:09-29
I want to use the VB control VB editor, such as clicking on a menu bar file, and then in the pop-up drop-down menu, click open project
Handle to the menu bar I can catch, simulate the mouse click is always not achieve them, The following program work in notepad, but for VB editor not achieve them, is there getmenu applicable condition? Option Explicit
Private Declare Function GetMenu Lib "user32. DLL" (ByVal HWND) As Long As Long Private Declare Function SendMessage Lib "user32. DLL" Alias "SendMessageA" (ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function FindWindow Lib "user32. DLL" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetMenuItemID Lib "user32. DLL" (ByVal hMenu As Long, ByVal nPos As Long) As Long Private Declare Function GetSubMenu Lib "user32. DLL" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Const WM_COMMAND As Long=& amp; H111
Private Sub Command1_Click () Dim h1 As Long, h2 As Long, id As Long
H1=FindWindow (vbNullString, "no title - notepad") 'meter things this handle The Debug. Print h1 The h2=GetMenu (h1) H2=GetSubMenu (h2, 0) 'file "menu handle to change the back of the 0, can 'get a different menu handle Id=GetMenuItemID (h2, 0) 'submenu "new" the id of the SendMessage h1, WM_COMMAND, id, ByVal 0 & amp;
End Sub Search more heterogeneous
CodePudding user response:
Window handle, Take the window coordinates, Move the mouse to the coordinates, Simulation by pressing the left mouse button,
CodePudding user response:
Use the http://www.autohotkey.com Or Wizard button
CodePudding user response:
Use the command can do good: A, open the project
"C: \ Program Files \ Microsoft Visual Studio \ VB98 \ vb6 exe" "D: \ VB \ Project1. VBP"
Second, direct compilation does not display the IDE
"C: \ Program Files \ Microsoft Visual Studio \ VB98 \ vb6 exe" "D: \ VB \ Project1. VBP"/make