Solved

Cheching a button is enable or not and click on them

Posted on 2004-08-05
4
258 Views
Last Modified: 2010-04-24
I am writing a program to control other applications.  I know how to get the handles to the top processes and the buttons in the applications. The question is how to determine whether the the buttons in other applications are enabled or not and if they are enabled I want to simulate a "click" on them (this is less important than finding whether it's enabled or not). Thanks for your help.
0
Comment
Question by:imagafx
  • 2
  • 2
4 Comments
 
LVL 48

Expert Comment

by:AlexFM
Comment Utility
Having the button handle you can use IsWindowEnabled function.
0
 
LVL 1

Author Comment

by:imagafx
Comment Utility
Alex, thanks for your help. And do you know to simulate a "click" on a button given the handle of that button? It's part of the question.
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
Comment Utility
int nID = GetDlgCtrlID(hButton);
HWND hParent = GetParent(hButton);

if ( hParent )
    PostMessage(hParent, WM_COMMAND,  nID, hButton);
0
 
LVL 1

Author Comment

by:imagafx
Comment Utility
Alex, thanks a lot.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now