PDA

Click to See Complete Forum and Search --> : Enable/diable push button?


softwareguy74
Jan 6th, 2001, 10:08 AM
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

Vlatko
Jan 6th, 2001, 10:27 AM
If you are using a dialog (the button is on the dialog) then:

EnableWindow(GetDlgItem(HwndofDialog,controlID) ,FALSE);

else you can always use FindWindow and FindWindowEx:

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
);

softwareguy74
Jan 6th, 2001, 10:40 AM
Thanks! worked like a charm..