简体   繁体   中英

Winapi: how to imitate a right button click on a specific node of a tree view control?

I'm looking for a way to send a "right mouse button pressed" message to a node of a tree view in some window. Sending message is not a problem - the problem is how do i find this control and how do i find the specific node (i know its displayed text)?

As I understand you are trying to emulate mouse click in foreign application and you want to search for handler to specific control to send message to it. I think you should run Spy++ or WinSpector application. They should allow you to quickly find what window and class name window have. Base on this you may use FindWindow/FindWindowEx/EnumChildWindows/GetDlgItem win32 api to get handler of it. And after that you can call PostMessage to send message to selected control. If you don't know what message you need to send you can use Spy++ or WinSpector to trace all messages that came to specified window and check what kind of them are send when you click using real mouse.

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