-
Hi,
I want to be able to enable/disable a push button on a dialog box. What I mean by that is: If I disable the button, it should be greyed out and not be able to be pushed.
Someone said use EnableWindow() but that requires a handle. Is this the correct function to use? If so, how do I determine the handle to a particular button?
Thanks,
Dan
-
If you are using a dialog (the button is on the dialog) then:
Code:
EnableWindow(GetDlgItem(HwndofDialog,controlID) ,FALSE);
else you can always use FindWindow and FindWindowEx:
Code:
HWND FindWindow(
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);
HWND FindWindowEx(
HWND hwndParent, // handle to parent window
HWND hwndChildAfter, // handle to a child window
LPCTSTR lpszClass, // pointer to class name
LPCTSTR lpszWindow // pointer to window name
);
-
Thanks! worked like a charm..