Changeset 22115 for branches


Ignore:
Timestamp:
Feb 9, 2016, 12:57:59 PM (10 years ago)
Author:
rousseau
Message:

Changed application termination [apitest]

Termination is now redirected to WM_CLOSE.
WM_CLOSE does a DestroyWindow(), which in turn generates a WM_DESTROY
message, which is where the main message-loop is ended by doing a call
to PostQuitMessage().

At exit however, the 'wParam' field of the 'msg' structure does not
contain the exit-code as provided with PostQuitMessage().

Location:
branches/swt/testapp/apitest
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/swt/testapp/apitest/ApiTest.properties

    r22113 r22115  
    22#The properties in this file are here to aid the developer by providing a backlink.
    33#This kinda has to do with 'modeling' and being able to 'regenerate' a published commit.
    4 #Sun, 07 Feb 2016 10:54:27 -0500
     4#Sun, 07 Feb 2016 19:51:37 -0500
    55
    6 meta-commit=none
     6meta-commit=9d829c3e499fe73c168edbbcf7112f4a12184f4e
  • branches/swt/testapp/apitest/src/ApiTestOdin.cpp

    r22113 r22115  
    9292                /* Message from the button, we post a message to close the window */
    9393                case ID_EXIT:
    94                     PostQuitMessage(0);
    95                     break;
    96 
    97                 /* Exit Message from the File Menu, forward it to ID_EXIT */
     94                    PostMessage(hwnd, WM_CLOSE, NULL, NULL);
     95                    break;
     96
     97                /* Message from the button, we post a message to close the window */
    9898                case ID_FILE_EXIT:
    99                     PostMessage(hwnd, WM_COMMAND, (UINT) ID_EXIT, NULL);
     99                    PostMessage(hwnd, WM_CLOSE, NULL, NULL);
    100100                    break;
    101101
     
    129129
    130130        /*
    131         // Request to quit the application.
     131        // This message is generated by a call to PostQuitMessage() or the
     132        // posting of a WM_QUIT message. It causes GetMessage() to return zero
     133        // and thus the message-loop to end. So this message is never
     134        // dispatched and this case thus never reached. After the message-loop
     135        // ends, the message-structure contains this message with an exit-code
     136        // (from PostQuitMessage()) in wParam.
    132137        */
    133138        case WM_QUIT:
     
    137142
    138143        /*
    139         // Request to close the application.
    140         // On Win32 WM_CLOSE does a DestroyWindow() but does not post a WM_QUIT
    141         // message and thus does not terminate the message-loop.
     144        // This message is sent when the close-button is clicked.
     145        // On Win32, DefWindowProc() does a DestroyWindow(), but does not post
     146        // a WM_QUIT message and thus does not terminate the message-loop.
    142147        */
    143148        case WM_CLOSE:
    144149            printf("WM_CLOSE received\n");
    145150            lres = DefWindowProc(hwnd, msg, wparam, lparam);
    146             PostQuitMessage(0);
    147             break;
    148 
    149         /*
    150         // Window is being destroyed, time to cleanup resources allocated.
     151            break;
     152
     153        /*
     154        // This message is generated by a call to DestroyWindow().
     155        // At the time this message is received, the windows and its children
     156        // are not destroyed yet.
    151157        */
    152158        case WM_DESTROY:
    153159            printf("WM_DESTROY received\n");
    154160            lres = DefWindowProc(hwnd, msg, wparam, lparam);
     161            PostQuitMessage(99);
    155162            break;
    156163
     
    262269    hwnd = CreateWindow(
    263270        MainWndClass,                   // Our Window Class
    264         "ApiTestOdin :: Main Window [generated:201602071054]",  // Caption Text
     271        "ApiTestOdin :: Main Window [generated:201602071950]",  // Caption Text
    265272        WS_OVERLAPPEDWINDOW,            // Window Stype
    266273        100,                            // The x-pos from ulc
     
    288295    }
    289296
     297    /* Last Message Info */
     298    printf("\n");
     299    printf("Last Message:\n");
     300    printf("msg.hwnd=%08X\n", msg.hwnd);
     301    printf("msg.message=%08X (%d)\n", msg.message, msg.message);
     302    printf("msg.wParam=%08X (%d)\n", msg.wParam, msg.wParam);
     303    printf("msg.lParam=%08X (%d)\n", msg.lParam, msg.lParam);
     304
    290305    /* App is terminating */
     306    printf("\n");
    291307    printf("ApiTestOdin is terminating...\n");
    292308
     
    303319    printf("\n");
    304320    printf("%s\n","###############################################################################");
    305     printf("%s\n","# This is the Odin variant of ApiTest                    version.201602071054 #");
     321    printf("%s\n","# This is the Odin variant of ApiTest                    version.201602071950 #");
    306322    printf("%s\n","###############################################################################");
    307323    printf("\n");
  • branches/swt/testapp/apitest/src/ApiTestOdin.def

    r22113 r22115  
    88;##############################################################################
    99
    10 NAME            ApiTestOdin     WINDOWAPI           ; PM
    11 ;NAME           ApiTestOdin     WINDOWCOMPAT        ; CLI
     10;NAME           ApiTestOdin     WINDOWAPI           ; PM
     11NAME            ApiTestOdin     WINDOWCOMPAT        ; CLI
    1212DESCRIPTION     'A Program to test the Odin32 API from an Odin Based Executable'
  • branches/swt/testapp/apitest/src/ApiTestPm.cpp

    r22113 r22115  
    208208            };
    209209    PSZ     pszClassClient  = (PSZ) "ApiTestPm";                // Window Class Name
    210     PSZ     pszTitle        = (PSZ) "ApiTestPm :: Main Window [generated:201602071054]";    // Window Title
     210    PSZ     pszTitle        = (PSZ) "ApiTestPm :: Main Window [generated:201602071950]";    // Window Title
    211211    ULONG   flStyleClient   = 0;                                // Style for Client Window
    212212    HWND    hwndFrame       = NULL;                             // Receives handle for Frame Window
     
    314314    printf("\n");
    315315    printf("%s\n","###############################################################################");
    316     printf("%s\n","# This is the PM variant of ApiTest                      version.201602071054 #");
     316    printf("%s\n","# This is the PM variant of ApiTest                      version.201602071950 #");
    317317    printf("%s\n","###############################################################################");
    318318    printf("\n");
  • branches/swt/testapp/apitest/src/ApiTestWin.cpp

    r22113 r22115  
    9595                /* Message from the button, we post a message to close the window */
    9696                case ID_EXIT:
    97                     PostQuitMessage(0);
    98                     break;
    99 
    100                 /* Exit Message from the File Menu, forward it to ID_EXIT */
     97                    PostMessage(hwnd, WM_CLOSE, NULL, NULL);
     98                    break;
     99
     100                /* Message from the button, we post a message to close the window */
    101101                case ID_FILE_EXIT:
    102                     PostMessage(hwnd, WM_COMMAND, (UINT) ID_EXIT, NULL);
     102                    PostMessage(hwnd, WM_CLOSE, NULL, NULL);
    103103                    break;
    104104
     
    132132
    133133        /*
    134         // Request to quit the application.
     134        // This message is generated by a call to PostQuitMessage() or the
     135        // posting of a WM_QUIT message. It causes GetMessage() to return zero
     136        // and thus the message-loop to end. So this message is never
     137        // dispatched and this case thus never reached. After the message-loop
     138        // ends, the message-structure contains this message with an exit-code
     139        // (from PostQuitMessage()) in wParam.
    135140        */
    136141        case WM_QUIT:
     
    140145
    141146        /*
    142         // Request to close the application.
    143         // On Win32 WM_CLOSE does a DestroyWindow() but does not post a WM_QUIT
    144         // message and thus does not terminate the message-loop.
     147        // This message is sent when the close-button is clicked.
     148        // On Win32, DefWindowProc() does a DestroyWindow(), but does not post
     149        // a WM_QUIT message and thus does not terminate the message-loop.
    145150        */
    146151        case WM_CLOSE:
    147152            printf("WM_CLOSE received\n");
    148153            lres = DefWindowProc(hwnd, msg, wparam, lparam);
    149             PostQuitMessage(0);
    150             break;
    151 
    152         /*
    153         // Window is being destroyed, time to cleanup resources allocated.
     154            break;
     155
     156        /*
     157        // This message is generated by a call to DestroyWindow().
     158        // At the time this message is received, the windows and its children
     159        // are not destroyed yet.
    154160        */
    155161        case WM_DESTROY:
    156162            printf("WM_DESTROY received\n");
    157163            lres = DefWindowProc(hwnd, msg, wparam, lparam);
     164            PostQuitMessage(99);
    158165            break;
    159166
     
    266273    hwnd = CreateWindow(
    267274        MainWndClass,                   // Our Window Class
    268         "ApiTestWin :: Main Window [generated:201602071054]",   // Caption Text
     275        "ApiTestWin :: Main Window [generated:201602071950]",   // Caption Text
    269276        WS_OVERLAPPEDWINDOW,            // Window Stype
    270277        100,                            // The x-pos from ulc
     
    292299    }
    293300
     301    /* Last Message Info */
     302    printf("\n");
     303    printf("Last Message:\n");
     304    printf("msg.hwnd=%08X\n", msg.hwnd);
     305    printf("msg.message=%08X (%d)\n", msg.message, msg.message);
     306    printf("msg.wParam=%08X (%d)\n", msg.wParam, msg.wParam);
     307    printf("msg.lParam=%08X (%d)\n", msg.lParam, msg.lParam);
     308
    294309    /* App is terminating */
     310    printf("\n");
    295311    printf("ApiTestWin is terminating...\n");
    296312
     
    307323    printf("\n");
    308324    printf("%s\n","###############################################################################");
    309     printf("%s\n","# This is the Windows variant of ApiTest                 version.201602071054 #");
     325    printf("%s\n","# This is the Windows variant of ApiTest                 version.201602071950 #");
    310326    printf("%s\n","###############################################################################");
    311327    printf("\n");
Note: See TracChangeset for help on using the changeset viewer.