DeleteMenu deletes, not disables.
EnableMenuItem enables or disables.
Whic to use depends on your preference: do you want the user to see the familiar System menu, but with "Close" greyed out and not selectable? Or would you prefer to have him see a menu which does not include a greyed-out "Close?"
Announcement
Collapse
No announcement yet.
Controlling behavior of Close Box on caption bar
Collapse
X
-
This will DISABLE the close "X"
DeleteMenu GetSystemMenu(hWnd,BYVAL 0),%SC_CLOSE,%MF_BYCOMMAND
Leave a comment:
-
Instead of disabling the button, how about trapping WM_SYSCOMMAND/SC_CLOSE in the callback and then triggering the cancel button code, using either GOTO or by sending BM_CLICK:
Code:Case %WM_SYSCOMMAND If (wParam And &HFFF0) = %SC_CLOSE Then ' MUST return TRUE to stop the dialog being destroyed... Function = %TRUE ' Call the shutdown code using GOTO... GOTO MyShutDown: ' OR, shutdown using the cancel button... CONTROL SEND CBHNDL, %IDCANCEL, %BM_CLICK, 0, 0 Exit Function End If
Leave a comment:
-
Controlling behavior of Close Box on caption bar
I'm using a dialog for multiple purposes. To distinguish them for the user I place an appropriate icon on the caption bar. To do this I must include %WS_SYSMENU in the template and this activates the CLOSE button. I want to disable this button and the CLOSE option in the system menu. All user response is then placed in one CANCEL button in the dialog. How do I get the ID of the close box so that I can disable it?
Thanx,
John Neubauer
I may have found the answer in a FAQ.Tags: None
Leave a comment: