hi,
can anyone tell me what win32 functions i need to call to disabled th applications close button, the one in the top right hand corner..
Thanks
Printable View
hi,
can anyone tell me what win32 functions i need to call to disabled th applications close button, the one in the top right hand corner..
Thanks
If you know the window handle:
Code:HMENU hSysMenu = GetSystemMenu(hMyWindow, FALSE);
EnableMenuItem(hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
sweet! thanks very much, that's exactly what i was after :D
I would advise against doing that though. Who likes running programs that they don't have control of?
If you have a specific close button or an OK button in a dialog, for example, this might be used. You can use it, you just need to be careful where you use it.
You can still do ALT-F4 or force it closed via task manager. I cant think of any legitimate reason to grey it out, probably some malware.
I've had legitimate reasons to disable the close button myself.
Usually I do it when I don't want someone to "close" the dialog when it makes no sense. For example, when you have to click a specific set of buttons. Which one of these does close represent? May be confusing to the user, too, in which case I would disable it.
A typical yes/no set of buttons, perhaps.
Windows automaticly disables the close button on Yes/No message boxs.
Which is a good example of when you can and should disable the close button.
I was referring more to custom dialogs which contains choices.