Is it possible to make a standard Windows Msg Box system modal?
Is it possible to make a standard Windows Msg Box system modal?
Try giving the message box the MB_SYSTEMMODAL style.
Doesn't work. Any other ideas?Originally posted by Ken Fitlike
Try giving the message box the MB_SYSTEMMODAL style.
I don't think that it is. But if you can get its HWND you could always change its style that way. But I don't even know how you would go about doing that.
Quote from Win32 SDK Reference talking about the flags:
Specify one of the following flags to indicate the modality of the dialog box:
MB_APPLMODAL The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other applications and work in those windows. Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the application. All child windows of the parent of the message box are automatically disabled, but popup windows are not.MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
MB_SYSTEMMODAL Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
"I don't think there's anything else I can do... my shoes are tied"
is there a flag I can specify that does not enable the user to select any other window without clicking out of the msg box?
You could do something really weird like capture the mouse SetCapture(HWND handleToWindowThatsCapturingTheMouse) and then track the mouse position GetCursorPos(address of POINT) and manipulate that with SetCursorPos(int x, int y); so as not to let it out of the message box. Call ReleaseCapture() api when done with the mouse caputre....
-Futura
Hehehehe, that's a sneaky, yet good idea. "Thou shalt press the button!".
Only problem would be if the user Alt-Tabbed out
"I don't think there's anything else I can do... my shoes are tied"
he he OK then to really get sneaky, hook the keyboard and don't call the next hook until the user responds to the message box. That will completely suspend all keyboard input.