How to disable push button - Win32 API

Or you can use code like this ::EnableWindow(hBtn,false)


To use Button_Enable macro, You need to insert

#include <windowsx.h>

in your header file.

Or, you can use EnableWindow() function:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646291%28v=vs.85%29.aspx


Or you can use EnableWindow with getting window handle if your dialog box that contains the control which need to disable:

EnableWindow(GetDlgItem(hwndDlg,BTN_TRIM),false); // to disable button or other control
EnableWindow(GetDlgItem(hwndDlg,BTN_TRIM),true);  // to enable button or other control

hwndDlg - A handle to the dialog box that contains the control
BTN_TRIM - The identifier of the control to be retrieved

Tags:

C++

Winapi