SendMessage到主窗口中集成的子窗口菜单

时间:2016-08-29 09:20:15

标签: vba automation

我试图使用同样的方法:

'lhWndP is the main window
menu = GetMenu(lhWndP)
menu_file = GetSubMenu(menu, 0)
menu_file_open = GetMenuItemID(menu_file, 1)
SendMessage lhWndP, WM_COMMAND, menu_file_open, 0

使用集成在主窗口中的子窗口(WindowsForms10.Window.8类型):

'lhWndP is the main window
lhWndP = FindWindowEx(lhWndP, 0&, "WindowsForms10.Window.8.app.0.235679a", "menustrip")
'lhWndP, now the child window, returns a correct handle
menu = GetMenu(lhWndP)
'getmenu returns the same handle of lhWndP, then getsubmenu returns 0
menu_file = GetSubMenu(menu, 0)
menu_file_open = GetMenuItemID(menu_file, 1)
SendMessage lhWndP, WM_COMMAND, menu_file_open, 0

我想我不能用子窗口应用getmenu方法。

任何想出解决方案的想法?

谢谢。

0 个答案:

没有答案