|
From: Marc H. <ma...@e-...> - 2003-08-11 17:09:39
|
Hi, Use EnableWindow(HWND hWnd, BOOL bEnable) to enable and disable a window (your button). Use GetDlgItem(HWND hDlg, int nIDDlgItem) to get the HWND of the window (button). So, EnableWindow(GetDlgItem(hDlg, ID_OK), FALSE)); Where hDlg is the handle to the dialog, will disable the button. Also, you should have only one DEFPUSHBUTTON, the one you want to be the default button. The others should just be PUSHBUTTON. __________________________________ Marc Heiligers =A0 =A0 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Chris = Sroka Sent: 11 August 2003 02:54 To: dev...@li... Subject: [Dev-C++] C++ dialog control I have created an OK pushbutton in a dialog box via a resource script = (see code below):=20 ****=20 =A0=A0=A0 DEFPUSHBUTTON=A0=A0 "Start", ID_START_CALC, 255, 7, 50, 14=20 =A0=A0=A0 DEFPUSHBUTTON=A0=A0 "OK", ID_OK, 255, 27, 50, 14=20 =A0=A0=A0 DEFPUSHBUTTON=A0=A0 "Cancel", ID_CANCEL, 255, 47, 50, 14=20 ****=20 I am trying to grey it out and disable it, from within a callback = function, while I carry out some calculations, and then enable it again when the = calcs are complete.=20 Does anyone know how to do this? I have tried SendDlgItemMessage with = the dialog's handle, the pushbutton's ID and various LPARAMs and WPARAMs but with no success. I have also trawled www.msdn.microsoft.com but found no suggestions.=20 Regards=20 Chris Sroka=20 |