|
-
Jan 27th, 2002, 08:20 PM
#1
Thread Starter
New Member
Popup menu question
I have a program that clicks on a button (in another program), once the button is clicked on a popup menu comes up. I want to click ont he second item on the popup menu (there are only two). How do I do it?
Window Class Name: "#32768"
Window Text: ""
-
Jan 28th, 2002, 05:17 PM
#2
Fanatic Member
I'm assuming you're clicking the first button using API... Just find the handle of the first button, then use FindWindowEx with that handle as its first argument, and voila, you get the next control fitting that class.
-
Jan 28th, 2002, 09:51 PM
#3
Thread Starter
New Member
I think I need to be a little clearer. I have my program click on a button. After it clicks on this button a popup menu comes up. There are to selection you can make on the menu. I want to click the second one. How can this be done?
-
Jan 28th, 2002, 10:08 PM
#4
Fanatic Member
Once your program has clicked on the main form, have it do a DoEvents in a loop until FindWindowEx turns up the dialog box where you want to click the second button. Then find the first button of whatever class the button is, then the second button. Here's some pseudo-code:
Find handle of target app
Find handle of first button (via its class), then use FindWindowEx until we have the desired button
Send a click message to the button using SendMessage
Wait until the dialog box pops up
Find the handle of the first button
Find the handle of the second button and send it a click message
Does this make sense? Hopefully the pseudo-code I wrote will help you narrow down what you need to figure out how to do.
-
Jan 29th, 2002, 09:49 AM
#5
Thread Starter
New Member
Umm what pops up after the button is clicked is a menu. It's a popup menu, it is a menu like when you right click on your desktop, a menu comes up. When I click on this button a menu comes up like that but it only has two options and I wanna know how to click the second one...
-
Jan 29th, 2002, 03:24 PM
#6
Fanatic Member
The only way I could figure out how to do that is use SendKeys, which I know is bad. For some reason, sending WM_Keydown with wparam of vbKeyDown did not work...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|