Winapi, dialog box procedure problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: Winapi, dialog box procedure problem

  1. #1
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Question Winapi, dialog box procedure problem

    Hey , first post Thanks all in advance, ive already been helped soo much by this site and others.


    Problem: I have 2 dialog box's and 2 dialog box procedures: BOOL 'name'DlgProc(bla bla).
    I am using a resource file to define the buttons, sizes ect.
    My 2 dialog box's work perfectly,I run into a issue when i create the third.

    Create Box definitions in resource file much the same as the others, create a third DlgProc().
    I run the program, when I open the first 2 dialog box's that work perfectly.
    When i run the third however, the box itself doesnt quite draw or become its own entity so
    to speak.
    I can see/click/edit the buttons/editbox's but the box itself doesnt draw.

    Now the percuilar(i cant spell) thing is that if, when i call the third dialog box, i instead of calling
    the new(third) DlgProc(), i call the second or the first, it draws perfectly.
    I have cut and pasted the first and second dialog box procedures and simply renamed and still
    the same issue(so i know its not some coding error, thus i didnt post any).

    Happy to post code if nessasry, but as i said, i have 2 box's working perfectly if i get rid of one of the other box's proc,
    the third works, is there a limit on how many DlgProc()'s your aloud to have?


    Thanks in Advance, Michael.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Winapi, dialog box procedure problem

    Best to post some code. Even better, assuming you're using Visual Studio, zip up your project directory (minus the .ncb, .aps, .suo, files and Debug and Release directories) ans post it here. There's no way to diagnose your problem from the information given.

  3. #3
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Re: Winapi, dialog box procedure problem

    Code:
    LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
    
    
    // globals
    
    
    char szClassName[ ] = "Mb Program !";
    
    int WINAPI WinMain (HINSTANCE hThisInstance,
                        HINSTANCE hPrevInstance,
                        LPSTR lpszArgument,
                        int nFunsterStil)
    
    {//WinMain() Open
        HWND hwnd;               /* This is the handle for our window */
        MSG messages;            /* Here messages to the application are saved */
        WNDCLASSEX wincl;        /* Data structure for the windowclass */
    
        /* The Window structure */
        wincl.hInstance = hThisInstance;
        wincl.lpszClassName = szClassName;
        wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
        wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
        wincl.cbSize = sizeof (WNDCLASSEX);
    
        /* Use default icon and mouse-pointer */
        wincl.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));
        wincl.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);
        wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
        wincl.lpszMenuName = MAKEINTRESOURCE(IDR_MYMENU);                 /* No menu */
        wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
        wincl.cbWndExtra = 0;                      /* structure or the window instance */
        /* Use Windows's default color as the background of the window */
        wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    
        /* Register the window class, and if it fails quit the program */
        if (!RegisterClassEx (&wincl))
            return 0;
    
        /* create the program window*/
        hwnd = CreateWindowEx (
               WS_EX_DLGMODALFRAME,  /*Specifies the extended window style of the window being created*/
               szClassName,         /* Classname */
               "MB TIPPIN",      /* Title Text */
               WS_OVERLAPPEDWINDOW, /* style - default window */
               200,                 /* X pos */
               200,                 /* Y pos */
               544,                 /* The programs width */
               375,                 /* and height in pixels */
               HWND_DESKTOP,        /* The window is a child-window to desktop */ 
               NULL,                /* No menu */
               hThisInstance,       /* Program Instance handler */
               NULL                 /* No Window Creation data */
               );
    
        /* Make the window visible on the screen */
        ShowWindow (hwnd, nFunsterStil);
    
        /* Run the message loop. It will run until GetMessage() returns 0 */
        while (GetMessage (&messages, NULL, 0, 0))
        { //While Open
            /* Translate virtual-key messages into character messages */
            TranslateMessage(&messages);
            /* Send message to WindowProcedure */
            DispatchMessage(&messages);
        }//While Close
    
        /* The program return-value is 0 - The value that PostQuitMessage() gave */
        return messages.wParam;
    }// WinMain() Close
    Code:
    // first dlgproc
    BOOL CALLBACK ENTERTIPSDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {//open TipsDlgProc
     switch(Message)
        {//open Switch
       
                case WM_INITDIALOG:
                     {
        
                     return TRUE;
                     }
                case WM_COMMAND:
                     {//wm command open
                  
                     switch(LOWORD(wParam))
                     {
                                           //case's
                                           }
                                           }
                                           }
     
     // 2 OTHER DLG PROCS THE SAME AS THIS, EXCEPT DIFFERNT CASES FOR BUTTONS ECT


    Code:
    LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {//WindowProcedure() open
        switch (message)                  /* handle the messages */
        { // Switch Open
            case WM_DESTROY:
                 {
                PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
                break;
                 }
    
     // ******* START WM_COMMAND ***************************************WM_COMMAND*********
            case WM_COMMAND:
                 { //WM_COMMAND Open
                            switch(LOWORD(wParam))
                            {//Switch(LOWORD(wParam)) open
                                                 case ID_FILE_EXIT: // exit check and exit...
                            if((MessageBox(hwnd, "Are you Sure you want to quit?","Attention",
                                           MB_YESNO | MB_ICONEXCLAMATION) ==IDNO))
                            return DefWindowProc(hwnd, message, wParam, lParam);
                            else PostQuitMessage (0);
                            break;
                                                 case ID_FILE_NEW:
                                                      {//ID_FILE_NEW open
                   DialogBox(GetModuleHandle(NULL), 
                   MAKEINTRESOURCE(IDD_NEW), hwnd, NewDlgProc);
             break;
        
                                                    } /* ID_FILE_NEW CLOSE */
                                                    case ID_FILE_ENTERTIPS:
                                                         { //ID-FILE_ENTERTIPS open
                                                        
                                                         
                   DialogBox(GetModuleHandle(NULL), 
                   MAKEINTRESOURCE(IDD_ENTERTIPS), hwnd, ENTERTIPSDlgProc);
                  
                   break;
                                                         } // ID_FILE_ENTER TIPS CLOSE
                                                  case ID_FILE_ENTER_RESULTS:
                                                       {
                   DialogBox(GetModuleHandle(NULL), 
                   MAKEINTRESOURCE(IDD_ENTER_RESULTS), hwnd, ENTERTIPSDlgProc);
                   break;
                                                       }
                                                                            
                
                            
                            
                            
                            
                            
                            }/* WM_command Switch Bracket Close */
                 } /* Wm_command Bracket  Close*/
                                                                 
                                                 
            default:   /* Default for WindowProcedure() Switch */                
                return DefWindowProc (hwnd, message, wParam, lParam);
        } /* WindowProcedure() Switch(message) bracket  Close*/
    
      //************************************************************
    Working with Dev C++ compiler.
    Sorry if posting code like this is wrong, first time ive posted on this site(any site acually )/
    Last edited by ovidiucucu; June 12th, 2010 at 09:42 AM. Reason: aded [CODE] and [/CODE] tags

  4. #4
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Re: Winapi, dialog box procedure problem

    //***********************************************************************************
    IDD_NEW DIALOG 0, 0, 239, 66 // ID = IDD_NEW TYPE = Dialog box
    CAPTION "New Player Rego" // diaglog box name
    FONT 12, "MS Sans Sherri" //font and text type
    BEGIN
    CTEXT "Player Name:", IDC_STATIC, 10,29,90,14 // text in dialog box
    EDITTEXT IDC_EDITBOX, 80,24,90,14, ES_AUTOHSCROLL // edit box for dialog box
    DEFPUSHBUTTON "Create Player", ID_CREATE_PLAYER,174,24,50,14 // create button for dialog box
    PUSHBUTTON "Quit", ID_QUIT, 174,45,50,14 // quit button for dialog box
    END
    //**************************************************************************

    All three dialog box's have exact same structure as this.
    and everythign is defined in header file correctly

  5. #5
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Winapi, dialog box procedure problem

    Trying to cut-n-paste all that into something that I can get to compile is proving to be near impossible. Do you have a project you can zip up?

  6. #6
    Join Date
    Apr 2010
    Location
    Western WA, USA
    Posts
    59

    Re: Winapi, dialog box procedure problem

    Quote Originally Posted by eggyegg123 View Post
    Code:
                   MAKEINTRESOURCE(IDD_ENTERTIPS), hwnd, ENTERTIPSDlgProc);
                  
    ........
                   MAKEINTRESOURCE(IDD_ENTER_RESULTS), hwnd, ENTERTIPSDlgProc);
    So, you are using the same dialog proc routine for two different dialog windows? I wonder if this is part of the problem.

  7. #7
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Re: Winapi, dialog box procedure problem

    srry bout the bodgey code dump, will try post more compilable code tomoz( main project is on work pc, i work alotta night shifts and get time to code in the wee hours of the morning).

    Quote: cosmicvoid
    *So, you are using the same dialog proc routine for two different dialog windows? I wonder if this is part of the problem.

    Well yes atm i am its a bad solution to the problem im having, if i call one of the first 2 procedures for the third dialog box, the box functions as expected. Its only when i call the third procedure that the box will not draw correctly, even if i simply copy/paste the first/second procedure and rename it.

    Atm im using the second dialog procedure to open my third dialog box, and using unique case ID's to give it functionality, its working quite well, but i know its wrong and don't understand why im having the issue to begin with

    Thanks for taking the time to look it over any way, i will post full code, zipped or other wise tommorow.
    (program should run on your pc, however will not function as intended, due to fixed file paths im using for testing.)

  8. #8
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,912

    Re: Winapi, dialog box procedure problem

    I can see/click/edit the buttons/editbox's but the box itself doesnt draw.
    Usually this happens when dialog procedure returns TRUE by default.

    Code:
    BOOL CALLBACK DlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
    {
    . . .
        return TRUE; // while FALSE should be here
    }
    Last edited by Igor Vartanov; June 13th, 2010 at 05:35 PM.
    Best regards,
    Igor

  9. #9
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Smile Re: Winapi, dialog box procedure problem

    ahh ok, il try that tonight, and let you know how it goes thx very much for the tip.

  10. #10
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Re: Winapi, dialog box procedure problem

    Quote:
    Usually this happens when dialog procedure returns TRUE by default.
    No Luck there, same problem still occuring with changed values.


    Code to come, if somone could tell me how to quote and post code like others do would be gr8 lol.
    Last edited by eggyegg123; June 14th, 2010 at 10:53 AM.

  11. #11
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Re: Winapi, dialog box procedure problem

    Figured out the codey/quotey thing

    Ok this is main.c, have gotton rid of main coding, this is skeleton, but same issue still arises when clicking EnterTips on the file menu.

    Code:
    #include <windows.h>
    #include "HeaderMB-guru.h"
    #include <stdlib.h>
    #include <stdio.h>
    #include <direct.h>
    #include <limits.h>
    
    
    
    
    /*  Declare Windows procedure  */
    
    LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
    
    char szClassName[ ] = "Mb Program !";
    
    int WINAPI WinMain (HINSTANCE hThisInstance,
                        HINSTANCE hPrevInstance,
                        LPSTR lpszArgument,
                        int nFunsterStil)
    
    {//WinMain() Open
        HWND hwnd;               /* This is the handle for our window */
        MSG messages;            /* Here messages to the application are saved */
        WNDCLASSEX wincl;        /* Data structure for the windowclass */
    
        /* The Window structure */
        wincl.hInstance = hThisInstance;
        wincl.lpszClassName = szClassName;
        wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
        wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
        wincl.cbSize = sizeof (WNDCLASSEX);
    
        /* Use default icon and mouse-pointer */
        wincl.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));
        wincl.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);
        wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
        wincl.lpszMenuName = MAKEINTRESOURCE(IDR_MYMENU);                 /* No menu */
        wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
        wincl.cbWndExtra = 0;                      /* structure or the window instance */
        /* Use Windows's default color as the background of the window */
        wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    
        /* Register the window class, and if it fails quit the program */
        if (!RegisterClassEx (&wincl))
            return 0;
    
        /* create the program window*/
        hwnd = CreateWindowEx (
               WS_EX_DLGMODALFRAME,  /*Specifies the extended window style of the window being created*/
               szClassName,         /* Classname */
               "MB TIPPIN",      /* Title Text */
               WS_OVERLAPPEDWINDOW, /* style - default window */
               200,                 /* X pos */
               200,                 /* Y pos */
               544,                 /* The programs width */
               375,                 /* and height in pixels */
               HWND_DESKTOP,        /* The window is a child-window to desktop */ 
               NULL,                /* No menu */
               hThisInstance,       /* Program Instance handler */
               NULL                 /* No Window Creation data */
               );
    
        /* Make the window visible on the screen */
        ShowWindow (hwnd, nFunsterStil);
    
        /* Run the message loop. It will run until GetMessage() returns 0 */
        while (GetMessage (&messages, NULL, 0, 0))
        { //While Open
            /* Translate virtual-key messages into character messages */
            TranslateMessage(&messages);
            /* Send message to WindowProcedure */
            DispatchMessage(&messages);
        }//While Close
    
        /* The program return-value is 0 - The value that PostQuitMessage() gave */
        return messages.wParam;
    }// WinMain() Close
    
    BOOL CALLBACK ENTERTIPSDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {//open TipsDlgProc
    
     
    
        switch(Message)
        {//open Switch
       
                case WM_INITDIALOG:
                     {
        
                     return FALSE;
                     }
                case WM_COMMAND:
                     {//wm command open
                  
                     switch(LOWORD(wParam))
                     {// switch LOWORD open
                     case ID_QUIT:
                          {
                          EndDialog(hwnd, IDOK);
                          break;
                          }
                     case IDC_SET: // Button Set 
                          { // case gSet Open
                      
                         
                          return TRUE;
     //*******************************************************************************
                          }
                          case IDC_ACCEPT:
                               {// accept open
                               
      
                          }// id accept close
    
                          }// switch(loword) close
                          }// wm command close
                          default:
                          return FALSE;
                          }// switch message close
                          return TRUE;
                          }// TipsDlgProc close             
    
    
    /**********************DIALOG BOX PROCEDURE For NEW PLAYER DIALOG BOX *********************/
    BOOL CALLBACK NewDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {//NewDlgProc Open
        switch(Message)
        {//switch(message) open
            case WM_INITDIALOG:
    
            return FALSE;
            case WM_COMMAND:
                 { // WM_COMMAND open
                switch(LOWORD(wParam))
                { //switch (LOWORD(wParam) open
                    case IDOK:
                        EndDialog(hwnd, IDOK);
                    break;
                    case ID_QUIT:
                        EndDialog(hwnd, ID_QUIT);
                        break;                      
                    case ID_CREATE_PLAYER: // **********CREATE PLAYER ***********************
                         { //id create_PLAYER open
                            
                    
                      } /* ID_CREATE_PLAYER CLOSE */ //*******CREATE PLAYER CLOSE ***********//
                       break; //break for create_player
                }      // Switch(loword(wParam)) Close     
                } /* WM_Command Close */
            break;
            default:
                return FALSE;
        } /* Switch Statement Close */
        return TRUE;
    } //newDlgProc() Close
    
    
    BOOL CALLBACK ResultsDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {//NewDlgProc Open
        switch(Message)
        {//switch(message) open
            case WM_INITDIALOG:
    
            return FALSE;
            case WM_COMMAND:
                { // WM_COMMAND open
                switch(LOWORD(wParam))
                { //switch (LOWORD(wParam) open
                case IDC_ACCEPT:
                    EndDialog(hwnd, IDOK); 
                     
                }
                }
                }
                }
                         
      
    LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {//WindowProcedure() open
        switch (message)                  /* handle the messages */
        { // Switch Open
            case WM_DESTROY:
                 {
                PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
                break;
                 }
    
     // ******* START WM_COMMAND ***************************************WM_COMMAND*********
            case WM_COMMAND:
                 { //WM_COMMAND Open
                            switch(LOWORD(wParam))
                            {//Switch(LOWORD(wParam)) open
                                                 case ID_FILE_EXIT: // exit check and exit...
                            if((MessageBox(hwnd, "Are you Sure you want to quit?","Attention",
                                           MB_YESNO | MB_ICONEXCLAMATION) ==IDNO))
                            return DefWindowProc(hwnd, message, wParam, lParam);
                            else PostQuitMessage (0);
                            break;
                                                 case ID_FILE_NEW:
                                                      {//ID_FILE_NEW open
                   DialogBox(GetModuleHandle(NULL), 
                   MAKEINTRESOURCE(IDD_NEW), hwnd, NewDlgProc);
             break;
        
                                                    } /* ID_FILE_NEW CLOSE */
                                                    case ID_FILE_ENTERTIPS:
                                                         { //ID-FILE_ENTERTIPS open
                                                        
                                                         
                   DialogBox(GetModuleHandle(NULL), 
                   MAKEINTRESOURCE(IDD_ENTERTIPS), hwnd, ENTERTIPSDlgProc);
                  
                   break;
                                                         } // ID_FILE_ENTER TIPS CLOSE
                                                  case ID_FILE_ENTER_RESULTS:
                                                       {
                   DialogBox(GetModuleHandle(NULL), 
                   MAKEINTRESOURCE(IDD_ENTER_RESULTS), hwnd, ResultsDlgProc);
                   break;
                                                       }
                                                                            
                
                            
                            
                            
                            
                            
                            }/* WM_command Switch Bracket Close */
                 } /* Wm_command Bracket  Close*/
                                                                 
                                                 
            default:   /* Default for WindowProcedure() Switch */                
                return DefWindowProc (hwnd, message, wParam, lParam);
        } /* WindowProcedure() Switch(message) bracket  Close*/
    
    /**********************END WM_COMMAND FOR MAIN WINDOW **************************************/
    
    
        return 0;
    } /*WindowProcedure Bracket Close*/


    This is header i save and #include it as "HeaderMB-guru.h"

    Code:
    #include <windows.h>
    
    // Menu's
    #define IDR_MYMENU 101
    // icons
    #define IDI_MYICON 102
    
    // menu items
    #define ID_FILE_EXIT 103
    #define ID_FILE_NEW 104
    #define ID_FILE_FINDPLAYER 105
    #define ID_FILE_ENTERTIPS 106
    #define ID_HELP_ERROR_MESSAGES 107
    #define ID_HELP_GENERAL 108
    
    // Crontols
    
    #define IDC_EDITBOX 201
    #define IDC_EDITBOX2 202 
    #define IDC_EDITBOX3 203
    #define IDC_EDITBOX4 204
    #define IDC_ENTER   2111
    #define IDD_ENTERTIPS 205
    #define ID_FILE_ENTER_RESULTS 111
    #define IDC_SET 112
    #define IDC_CONFIRM 116
    #define ID_OK 107
    #define ID_CANCEL 108 
    #define ID_CREATE_PLAYER 109 
    #define ID_QUIT 110
    #define IDC_ACCEPT 140
    #define IDC_EDITBOX5 141
    #define IDC_WEEKNUMBER 142
    #define IDC_GAMEBOX1   143
    #define IDC_GAMEBOX2   144
    #define IDC_GAMEBOX3   145
    #define IDC_GAMEBOX4   146
    #define IDC_GAMEBOX5   147
    #define IDC_GAMEBOX6   148
    #define IDC_GAMEBOX7   149
    #define IDC_GAMEBOX8   150
    #define IDC_GAMEBOX9   151
    
    
    
    // variables
    #define IDC_SHOWNAME 114
    #define IDC_SHOWID 115
    
    // dialogs
    #define IDD_ENTER_WEEK 206
    #define IDD_NEW 207
    #define IDD_ENTER_RESULTS 208
    #define IDC_STATIC -1
    This is rc file
    Code:
    #include <windows.h>
    #include "HeaderMB-guru.h"
    
    
    
    //**********************************************************************************
    IDI_MYICON ICON "C:\\dev-cpp\\icons\\crazy.ico" // icon for main app
    //***********************************************************************************
    IDD_NEW DIALOG 0, 0, 239, 66 // ID = IDD_NEW  TYPE = Dialog box
    CAPTION "New Player Rego"        // diaglog box name
    FONT 12, "MS Sans Sherri"        //font and text type
    BEGIN
         CTEXT "Player Name:", IDC_STATIC,                10,29,90,14  // text in dialog box 
         EDITTEXT IDC_EDITBOX,                            80,24,90,14, ES_AUTOHSCROLL // edit box for dialog box
         DEFPUSHBUTTON "Create Player", ID_CREATE_PLAYER,174,24,50,14 // create button for dialog box
         PUSHBUTTON "Quit", ID_QUIT,                     174,45,50,14 // quit button for dialog box
    END
    //***********************************************************************************
    
    IDD_ENTERTIPS DIALOG 0, 0, 259,100
    CAPTION "Enter Tips!" // dialog box name
    FONT 8, "MS Sans Sherri" //font and text type
    BEGIN
    
          CTEXT          "Week no ", IDC_STATIC,             7,10, 30,14 
          EDITTEXT IDC_EDITBOX3,                             40,5, 30,14, ES_AUTOHSCROLL  
          
          CTEXT        "User ID", IDC_STATIC,                10/*left*/,25/*top*/, 30/*width*/,14/*height*/
          EDITTEXT IDC_EDITBOX2,                             40,22 , 30,14, ES_AUTOHSCROLL
         
          
          CTEXT "Tips", IDC_STATIC,                          10,38,30,14 
          EDITTEXT IDC_EDITBOX4,                             40,38,40,14, ES_AUTOHSCROLL                                    
       
          CTEXT "Name:", IDC_STATIC,                         10,55,30,14
          CTEXT " ", IDC_SHOWNAME,                           40,55,30,14
          
          DEFPUSHBUTTON "Set",IDC_SET,                       90,38 , 50,14
          PUSHBUTTON    "Confirm", IDC_CONFIRM,              80,70, 70,14, WS_DISABLED
          PUSHBUTTON    "Quit",ID_QUIT,                      190,80,50,14 // quit button for dialog box
        
    
         END
    //******************************************************************************
    
    IDD_ENTER_RESULTS DIALOG 0,0,259,100
    CAPTION "Enter Results"
    FONT 8, "MS Sans Sherri" //font and text type
    BEGIN
    
    
    CTEXT "HOME TEAM WIN = 1", IDC_STATIC,                  170,10,80,14
    CTEXT "AWAY TEAM WIN = 2", IDC_STATIC,                  170,20,80,14
    
         CTEXT "Game", IDC_STATIC,                          10,35,30,14
         
         CTEXT "G1", IDC_STATIC,                            40,20,15,14
         EDITTEXT IDC_GAMEBOX1,                             40,35,15,14, ES_AUTOHSCROLL
         
         CTEXT "G2", IDC_STATIC,                            65,20,15,14
         EDITTEXT IDC_GAMEBOX2,                             65,35,15,14, ES_AUTOHSCROLL
         
         CTEXT "G3", IDC_STATIC,                            90,20,15,14
         EDITTEXT IDC_GAMEBOX3,                             90,35,15,14, ES_AUTOHSCROLL
         
         CTEXT "G4", IDC_STATIC,                            115,20,15,14
         EDITTEXT IDC_GAMEBOX4,                             115,35,15,14, ES_AUTOHSCROLL
         
         CTEXT "G5", IDC_STATIC,                            40,55,15,14
         EDITTEXT IDC_GAMEBOX5,                             40,70,15,14, ES_AUTOHSCROLL
         
         CTEXT "G6", IDC_STATIC,                            65,55,15,14
         EDITTEXT IDC_GAMEBOX6,                             65,70,15,14, ES_AUTOHSCROLL
         
         CTEXT "G7", IDC_STATIC,                            90,55,15,14
         EDITTEXT IDC_GAMEBOX7,                             90,70,15,14, ES_AUTOHSCROLL
         
         CTEXT "G8", IDC_STATIC,                            115,55,15,14
         EDITTEXT IDC_GAMEBOX8,                             115,70,15,14, ES_AUTOHSCROLL
         
         CTEXT "G9", IDC_STATIC,                            140,55,15,14
         EDITTEXT IDC_GAMEBOX9,                             140,70,15,14, ES_AUTOHSCROLL
         
         
         
         
         
         DEFPUSHBUTTON "Accept", IDC_ACCEPT,                200,60,50,14
        
         
         CTEXT "Week", IDC_WEEKNUMBER,                      20,5,20,14
         EDITTEXT IDC_EDITBOX5,                             40,5,20,14, ES_AUTOHSCROLL
         
         PUSHBUTTON "Quit", ID_QUIT,                       200,80,50,14
    END
    //******************************************************************************
    
    
    
    IDR_MYMENU MENU                                 // menu for main app
    BEGIN
        POPUP "&File"
                                      // file is what you see on the main tool bar
        BEGIN
         MENUITEM "New Player", ID_FILE_NEW      //{  sub menu items for under FILE in toolbar
         MENUITEM "Enter Tips", ID_FILE_ENTERTIPS 
         MENUITEM "Enter Results", ID_FILE_ENTER_RESULTS
         MENUITEM "E&xit", ID_FILE_EXIT //{
                
          
        END
        POPUP "HELP"
        
        BEGIN
         MENUITEM "General", ID_HELP_GENERAL
         MENUITEM "Error Messages", ID_HELP_ERROR_MESSAGES
        
        END
    END

  12. #12
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Re: Winapi, dialog box procedure problem

    Would like to again thank everyone who is/has taking/taken the time to look at this problem that is driving me nuts.
    Im new to winapi and C (my first languages). Self taught and relise im doing alot of things incorrectly, but any problem i have i tend to google and figure out by my self, but this issue just baffles me,.
    i dnt understand why 2 dialog procedures work 100% perfectly fine and the third screws up :/

    Thanks again, michael

  13. #13
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,912

    Re: Winapi, dialog box procedure problem

    No Luck there, same problem still occuring with changed values.
    Of course no luck, as you changed nothing.
    Code:
    BOOL CALLBACK ResultsDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {//NewDlgProc Open
        switch(Message)
        {//switch(message) open
            case WM_INITDIALOG:
    
            return FALSE;
            case WM_COMMAND:
                { // WM_COMMAND open
                switch(LOWORD(wParam))
                { //switch (LOWORD(wParam) open
                case IDC_ACCEPT:
                    EndDialog(hwnd, IDOK); 
                     
                }
                }
                }
    return FALSE;
                }
    Best regards,
    Igor

  14. #14
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Red face Re: Winapi, dialog box procedure problem

    ... <<<iddiot for not reading igor's post properly
    Last edited by eggyegg123; June 14th, 2010 at 05:15 PM.

  15. #15
    Join Date
    Jun 2010
    Location
    Aussie Land
    Posts
    10

    Talking Re: Winapi, dialog box procedure problem

    FIXED! Thank you Igor Vartanov, i should have read more carefully, when you worte "Returns True by Default", changed and now working !

    TYVM

    Sorry for stuffing up such good advice

    Truely apreciate it .

    Michael

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center