Link to home
Start Free TrialLog in
Avatar of bmuralimohan
bmuralimohan

asked on

Disable the 'X' button on the titlebar of a dialog box

Hi,
    In a VC++ application, the 'X' button of the Dialog's titlebar is required to be disabled. This cannot be set directly in the dialog's property. Is there any othere programmatical way of disabling it??
Please reply me as soon as possible as it is very urgent.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Laminamia063099
Laminamia063099

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

There is a better way

This is done through a round-about means.  You must disable the close menu option of the window's system menu, then the button will be disabled. Use

HMENU SysMen = GetSystemMenu(WndHnd,false); // >> window's system menu.

EnableMenuItem(SysMen,SC_CLOSE,MF_BYCOMMAND | MF_DISABLED);
I stand corrected.  There is a better way :)

Thanks nietod.