The API function you want is EnableWindow.
BOOL EnableWindow(
HWND hWnd, // handle to window
BOOL bEnable // flag for enabling or disabling input
);
Parameters
hWnd
Identifies the window to be enabled or disabled.
bEnable
Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.
Return Values
If the window was previously disabled, the return value is nonzero.
If the window was not previously disabled, the return value is zero. To get extended error information, call GetLastError.
What you can do is call it like this for a dialog button:
Code:
EnableWindow(GetDlgItem(hWnd, ID_BUTTON), 0);
- Sean