Msg Box query

This is a discussion on Msg Box query within the Windows Programming forums, part of the Platform Specific Boards category; Is it possible to make a standard Windows Msg Box system modal?...

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    Msg Box query

    Is it possible to make a standard Windows Msg Box system modal?
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Try giving the message box the MB_SYSTEMMODAL style.

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Originally posted by Ken Fitlike
    Try giving the message box the MB_SYSTEMMODAL style.
    Doesn't work. Any other ideas?
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    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.

  5. #5
    Registered User Penguin of Oz's Avatar
    Join Date
    Dec 2002
    Posts
    16
    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"

  6. #6
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    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?
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  7. #7
    Registered User
    Join Date
    Dec 2002
    Posts
    119
    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

  8. #8
    Registered User Penguin of Oz's Avatar
    Join Date
    Dec 2002
    Posts
    16
    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"

  9. #9
    Registered User
    Join Date
    Dec 2002
    Posts
    119
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 01:59 PM
  2. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 08:34 PM
  3. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 07:00 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. msg box prob
    By Unregistered in forum C Programming
    Replies: 15
    Last Post: 12-16-2001, 07:20 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21