Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Control other apps's button / dialog handle ?

This topic is 5988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing a little program to learn how to control or get info from other programs (for my other program I made a very simple windows app with a menu, text boxes and buttons). So, for example, I can get the "title" from the other app: HWND hwndapp = FindWindow("classname",NULL); GetWindowText(hwndapp,title,sizeof(title)); cout << title; or run a menu item from the other app... #1. My first question is how to control buttons in the other app from my program (like simulating an OK or CANCEL press)? Im guessing it will be done using "SendMessage(" , but I am not sure how to get the handle to the button and what the message is (maybe BN_CLICKED or BM_SETSTATE?) #2. And my second question is how do you get a handle to a dialog (like when you run SPY++ and see "#32770 (Dialog)" as the class name), so I can do the same things as to the main window (getting title, pressing buttons). If you could help me out with either question, I would appreciate it. Thanks.

Share this post

Link to post
Share on other sites
nevermind i got it...

pressing a button is:

HWND hbtnNext = GetDlgItem(hwndPRO, 12324); //12324 is the ID
PostMessage(hbtnNext, WM_LBUTTONDOWN, 0, MAKELONG(10, 5)); // wParam, lParam = x,y
PostMessage(hbtnNext, WM_LBUTTONUP, 0, MAKELONG(10, 5));

and dialog handle is:

HWND hwndPRO = FindWindow(0, "Title of window");

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!