Thread: Dialog Box Problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Yah. Morgul's Avatar
    Join Date
    Feb 2005
    Posts
    109
    Yes I did:

    uType
    [in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.
    To indicate the buttons displayed in the message box, specify one of the following values.
    MB_ABORTRETRYIGNORE
    The message box contains three push buttons: Abort, Retry, and Ignore.
    MB_CANCELTRYCONTINUE
    Microsoft Windows 2000/XP: The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
    MB_HELP
    Windows 95/98/Me, Windows NT 4.0 and later: Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
    MB_OK
    The message box contains one push button: OK. This is the default.
    MB_OKCANCEL
    The message box contains two push buttons: OK and Cancel.
    MB_RETRYCANCEL
    The message box contains two push buttons: Retry and Cancel.
    MB_YESNO
    The message box contains two push buttons: Yes and No.
    MB_YESNOCANCEL
    The message box contains three push buttons: Yes, No, and Cancel.
    To display an icon in the message box, specify one of the following values.
    MB_ICONEXCLAMATION
    An exclamation-point icon appears in the message box.
    MB_ICONWARNING
    An exclamation-point icon appears in the message box.
    MB_ICONINFORMATION
    An icon consisting of a lowercase letter i in a circle appears in the message box.
    MB_ICONASTERISK
    An icon consisting of a lowercase letter i in a circle appears in the message box.
    MB_ICONQUESTION
    A question-mark icon appears in the message box.
    MB_ICONSTOP
    A stop-sign icon appears in the message box.
    MB_ICONERROR
    A stop-sign icon appears in the message box.
    MB_ICONHAND
    A stop-sign icon appears in the message box.
    To indicate the default button, specify one of the following values.
    MB_DEFBUTTON1
    The first button is the default button.
    MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.

    MB_DEFBUTTON2
    The second button is the default button.
    MB_DEFBUTTON3
    The third button is the default button.
    MB_DEFBUTTON4
    The fourth button is the default button.
    To indicate the modality of the dialog box, specify one of the following values.
    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 threads 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 thread. 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.
    MB_TASKMODAL
    Same as MB_APPLMODAL except that all the top-level windows belonging to the current thread are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the calling thread without suspending other threads.
    To specify other options, use one or more of the following values.
    MB_DEFAULT_DESKTOP_ONLY
    Windows NT/2000/XP: Same as MB_SERVICE_NOTIFICATION except that the system will display the message box only on the default desktop of the interactive window station. For more information, see Window Stations.
    Windows NT 4.0 and earlier: If the current input desktop is not the default desktop, MessageBox fails.

    Windows 2000/XP: If the current input desktop is not the default desktop, MessageBox does not return until the user switches to the default desktop.

    Windows 95/98/Me: This flag has no effect.

    MB_RIGHT
    The text is right-justified.
    MB_RTLREADING
    Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
    MB_SETFOREGROUND
    The message box becomes the foreground window. Internally, the system calls the SetForegroundWindow function for the message box.
    MB_TOPMOST
    The message box is created with the WS_EX_TOPMOST window style.
    MB_SERVICE_NOTIFICATION
    Windows NT/2000/XP: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
    Terminal Services: If the calling thread has an impersonation token, the function directs the message box to the session specified in the impersonation token.

    If this flag is set, the hWnd parameter must be NULL. This is so the message box can appear on a desktop other than the desktop corresponding to the hWnd.

    For more information on the changes between Microsoft Windows NT 3.51 and Windows NT 4.0, see Remarks.

    MB_SERVICE_NOTIFICATION_NT3X
    Windows NT/2000/XP: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51.
    For more information on the changes between Windows NT 3.51 and Windows NT 4.0, see Remarks.
    Do cntrl+f (find) on this page and search for WS_TOPMOST and WS_SETFOREGROUND

    Everything compiles, I have even rebuilt the project. I go to make the dialog box appears, and nothing happens.

    I'm going to test GetLastError, ill edit with my results...

    --------- edit----------

    I got an error code of 1812. This is:

    ERROR_RESOURCE_DATA_NOT_FOUND
    1812
    The specified image file did not contain a resource section.
    This means that my resource is screwed up. However, it seems to be compiling fine. I don't see anything wrong with my resource, I even tried taking out the WS_TOPMOST and WS_SETFOREGROUND, and it didn't help.

    Resource (just to make sure I have the most up-to-date version here):
    Code:
    #include "hdandn.hpp"
    
    IDD_DLGJOIN DIALOG 260, 200, 188, 95
    STYLE DS_MODALFRAME | WS_CAPTION | WS_TOPMOST | WS_SETFOREGROUND | WS_VISIBLE
    CAPTION "Join a Game"
    FONT 8, "Courier New"
    BEGIN
        DEFPUSHBUTTON   "OK", ID_DLGOK, 130, 10, 50, 14
    END
    Last edited by Morgul; 05-29-2005 at 02:50 PM.
    Sic vis pacum para bellum. If you want peace, prepare for war.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>Yes I did:<<

    That looks to be the msdn description for the MessageBox function. I searched through what you've posted and didn't find either WS_TOPMOST nor WS_SETFOREGROUND styles. I also searched through the linked CreateWindow page you provided and didn't find anything there either.

    There is an extended window style (see CreateWindowEx, dwExStyle parameter description) of WS_EX_TOPMOST, though, which is maybe where you're getting confused. But to use extended styles in resource generated dialogs you need to use the DIALOGEX resource definition statement in your resource script and not DIALOG as you have done. There's also MB_SETFOREGROUND and MB_TOPMOST flags listed for the MessageBox function but neither of these are window styles.

    Although MessageBoxes are essentially dialog boxes it's probably best not to mix them up in the way you are implying.

    Since you seem to be using undefined constants in your project and that project compiles without error, it may be that the resource script is somehow not being included in the build; if it was windres, the resource compiler used by Dev-Cpp, would be emitting its legendary and ambiguous 'parse' errors.

    Did you try this?
    Quote Originally Posted by Ken Fitlike
    >>Still, nothing happens<<

    Is the return value of your DialogBox call zero?

    If it is, have you tried to find out why with GetLastError?
    edit: Well beaten by Codeplug.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Display text in a Dialog Box
    By Dark_Phoenix in forum Windows Programming
    Replies: 9
    Last Post: 01-02-2009, 06:30 AM
  2. Dialog Box (Compile Problem)
    By Vicious in forum Windows Programming
    Replies: 6
    Last Post: 08-31-2004, 03:29 PM
  3. problem with the open dialog box
    By stallion in forum Windows Programming
    Replies: 13
    Last Post: 02-19-2003, 08:28 AM
  4. Context Menu & Dialog Box :: MFC
    By kuphryn in forum Windows Programming
    Replies: 4
    Last Post: 08-11-2002, 10:01 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM