Cheching a button is enable or not and click on them

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.
LVL 1
imagafxAsked:
Who is Participating?
 
AlexFMConnect With a Mentor Commented:
int nID = GetDlgCtrlID(hButton);
HWND hParent = GetParent(hButton);

if ( hParent )
    PostMessage(hParent, WM_COMMAND,  nID, hButton);
0
 
AlexFMCommented:
Having the button handle you can use IsWindowEnabled function.
0
 
imagafxAuthor Commented:
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
 
imagafxAuthor Commented:
Alex, thanks a lot.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.