简体   繁体   中英

How to click on Menu items with PostMessage/SendMessage User32

Hello i have Windows aplication,i need to click on One on Menu/Tabs items.I can find the Menu with all options,files,help.... tabs ,but i can't find the way how to get to my item.

I can't send picture of my aplication,but i will send the same example/logic with IE where i need to Click on Greek(IOS).

1.I need to click on View

2.Hover Encoding

3.Hover More

and 4. Click Greek(IOS).

在此处输入图片说明

I can find the all bar Menu with File,Edut,View,Tools,Help

intWhdr = FindWindow(Step1Window.Class, Step1Window.Name);//Program 
currChild = FindWindowEx(intWhdr, 0, "WindowsForms10.Window.", "mainMenu");//Menu

here i have my Main menu , here i stuck i can't find the way to press on menu item(like in Ie example)View menu. I don't even need the hover action i can user SendMessage DownArrow and RightArrow to get to my item, but i neeed to click on View first.

Any ideas how to click on View menu form Menu bar?with SendMessage/PostMessage

UPDATE

在此处输入图片说明

使用spy ++跟踪传递到菜单栏的所有事件,然后尝试重新发送程序中的消息。

After long research and with help of dvasanth ,i find the salution

1.Yon need to find WM_LBUTTONUP/DOWN NOT WM_SETCURSOR like in img,than open the properties and find wParam and lParam

2.Change format 011C16A8 just by adding 0x+lParam/wParam

Ex: 011C16A8 = 0x011C16A8

EX: 00000001= 0x01

EX: 00000012=0x12

I think i get an idea....

In my case i find in properties :

WM_LBUTTONUP

lParam=00000001
wParam=000C0348

WM_LBUTTONDOWN

lParam=00000000
wParam=000C0348

sow after edit they look like this:

WM_LBUTTONUP

lParam=0x01
wParam=0x000C0348

WM_LBUTTONDOWN

 lParam=0x00
 wParam=0x000C0348

3.Just insert this to your code.

My code that worked:

intRes1 = PostMessage(currChild, WM_LBUTTONDOWN, 0x01, 0x000C0348);
System.Threading.Thread.Sleep(100);
intRes1 = PostMessage(currChild, WM_LBUTTONUP, 0x00, 0x000C0348);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM