windows_programming_notes.nbk: Home | Index | Next Page: Sandbox | Previous Page: sample modal dialog box


 sample modal dialog box procedure

//##############################################################################
// 
//##############################################################################
BOOL CALLBACK dialog_procedure(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) 
{ 
    int     id;
    int     notification;

    switch (message) { 
    case WM_COMMAND: 
        id           = LOWORD(wparam);
        notification = HIWORD(wparam);

        switch (id) { 
        case IDOK: 
            EndDialog(hwnd, wparam); 
            return TRUE; 
        case IDCANCEL: 
            EndDialog(hwnd, lparam); 
            return TRUE; 
       } 
    } 
    return FALSE; 
} 

The wParam argument to EndDialog is the value that DialogBox or DialogBoxParam returns. This is used to signal the results of the dialog box, usually indicating whether the user clicked the OK or Cancel button, as in this case.


windows_programming_notes.nbk: Home | Index | Next Page: Sandbox | Previous Page: sample modal dialog box


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time