Menu

Dialog Box Failure(Why)

JJFMJR
2007-09-07
2012-09-26
  • JJFMJR

    JJFMJR - 2007-09-07

    Hey all, I'm having trouble with a Dialog Box. Heres the code:

    Part of WinMain
    [code]
    case ID_New:
    {
    if(!pCurrentLevel)
    {
    int ret = DialogBox(GetModuleHandle(NULL),
    MAKEINTRESOURCE(DB_New), hWnd, NewDlgProc);

                        if(ret = -1)
                            MessageBox(hWnd, "Dialog Failed", "Warning", MB_OK | MB_ICONINFORMATION);
    
    
                        pCurrentLevel = new Level();
                        pCurrentLevel->theme = Temple_Maze;
                        pCurrentLevel->changed = true;
                        pCurrentLevel->width = 35;
                        pCurrentLevel->depth = 35;
                        pCurrentLevel->floors = 1;
    
                        if(!pCurrentLevel->Setup())
                            MessageBox(hWnd, "Error setting up level.", "Error", MB_OK);
    
                        break;
                    }
    
                    else
                        MessageBox(hWnd, "You already have a level open", "New Level..", MB_OK);
    
                    break;
                }
    

    [/code]

    My Resource File:
    [code]

    include <windows.h>

    include "Dialogs.h"

    if !defined (_WINDOWS)

    define _WINDOWS

    endif

    DB_NEW DIALOG DISCARDABLE 50, 50, 700, 560
    STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "Create New.."
    FONT 8, "MS Sans Serif"

    BEGIN

    DEFPUSHBUTTON   &quot;&amp;OK&quot;,IDOK,174,18,50,14
    PUSHBUTTON      &quot;&amp;Cancel&quot;,IDCANCEL,174,35,50,14
    

    END
    [/code]

    And IDs

    [code]

    ifndef DialogTypes

    define DialogTypes

    define DB_New 99999

    endif

    [/code]

    This Dialog is extreemely important to my program(It's just being created right now, I will change it once it opens).
    When I select new, the Dialog Failed Message box appears, showing the dialog returned -1 a failure.

     
    • JJFMJR

      JJFMJR - 2007-09-07

      Lol good point, fixed the (ret = -1), however the dialog still doesn't show, and the messagebox still appears.

       
    • Osito

      Osito - 2007-09-07

      This doesn't look good:

      if(ret = -1)

      :)

       
      • Wayne Keen

        Wayne Keen - 2007-09-07

        A favorite error of mine - Python won't let me do it fortunately

        Wayne

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.