Changeset 22112 for branches/swt/testapp/apitest/src/ApiTestPm.cpp
- Timestamp:
- Jan 25, 2016, 4:22:26 PM (10 years ago)
- File:
-
- 1 edited
-
branches/swt/testapp/apitest/src/ApiTestPm.cpp (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/swt/testapp/apitest/src/ApiTestPm.cpp
r22109 r22112 1 1 //! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate 2 2 /*****************************************************************************\ 3 * ApiTestPm.cpp *3 * ApiTestPm.cpp :: This is the PM variant of ApiTest * 4 4 * --------------------------------------------------------------------------- * 5 * Th is is the PM version of the ApiTest program.*6 * It is used as a casco to construct the basic structure.*7 * Note that this is not the program of focus, that would be the Odin32 and*8 * Win32 variants which will use the Odin32-API and will be added in upcoming*9 * commits.*5 * The PM version has a different purpose than the Odin Based and Windows * 6 * variants. Here the focus is not directly on testing the Odin32-API, but * 7 * rather on testing the OS/2-API. While Odin implements a lot of Win32 * 8 * functionality from scratch, there are also situations where things are * 9 * delegated to OS/2. This variant provides that angle. * 10 10 \*****************************************************************************/ 11 11 12 12 13 13 /* 14 // Include the standard C/C++ headers.14 // Standard C/C++ Headers 15 15 */ 16 16 #include <stdlib.h> … … 18 18 #include <string.h> 19 19 20 /* 21 // Include the Platform headers for OS/2. 20 21 22 /* 23 // Platform Headers for OS/2 22 24 */ 23 25 #define INCL_DOS … … 26 28 27 29 28 /* 29 // Module related include-files. 30 31 /* 32 // Module Headers 30 33 */ 31 34 #include "ids.h" 32 33 /* 34 // Minimal Window Procedure. 35 */ 36 MRESULT EXPENTRY PmWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { 35 #include "ApiTestPm.hpp" 36 37 38 39 /* 40 // Minimal Window Procedure 41 */ 42 MRESULT EXPENTRY Pm32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { 37 43 /* 38 44 // Local Variables follow here. … … 54 60 /* 55 61 // Create a button on the client-window 56 // ------------------------------------57 // So we can quickly exit the application by just pressing58 // the space-bar.59 62 */ 60 63 do { … … 63 66 /* Create the button */ 64 67 hwndButton = WinCreateWindow( 65 hwnd, // Parent (client-window)66 WC_BUTTON, // We want a window of class WC_BUTTON67 (PSZ)"Bye", // The button-text68 WS_VISIBLE|BS_PUSHBUTTON, // Make it visible69 20, // The x-pos from llc70 20, // The y-pos from llc71 100, // Width of the button72 50, // Height of the button73 hwnd, // Owner (client-window)74 HWND_TOP, // Z-order75 ID_EXIT, // Window ID76 NULL, // Control Data (none)77 NULL // Presentation Parameters (none)68 hwnd, // Parent (client-window) 69 WC_BUTTON, // We want a window of class WC_BUTTON 70 (PSZ)"Bye", // The button-text 71 WS_VISIBLE|BS_PUSHBUTTON, // Make it visible 72 20, // The x-pos from llc 73 20, // The y-pos from llc 74 100, // Width of the button 75 50, // Height of the button 76 hwnd, // Owner (client-window) 77 HWND_TOP, // Z-order 78 ID_EXIT, // Window ID 79 NULL, // Control Data (none) 80 NULL // Presentation Parameters (none) 78 81 ); 79 82 /* Give the focus to the button */ … … 120 123 printf("WM_COMMAND received, id: %04d\n", SHORT1FROMMP(mp1)); 121 124 break; 122 125 default: 126 mres = WinDefWindowProc(hwnd, msg, mp1, mp2); 127 break; 123 128 } 124 129 break; /*WM_COMMAND*/ … … 133 138 134 139 /* 140 // Request to quit the application. 141 */ 142 case WM_QUIT: 143 printf("WM_QUIT received\n"); 144 mres = WinDefWindowProc(hwnd, msg, mp1, mp2); 145 break; 146 147 /* 135 148 // Request to close the application. 149 // On PM this this posts a WM_QUIT message which in turn terminates 150 // the message-loop. Only an explicit call to WinDestroyWindow() 151 // seems to generate a WM_DESTROY message, which we do after the loop 152 // has terminated. 153 // On Win32 WM_CLOSE does a DestroyWindow() but does not post a WM_QUIT 154 // message and thus does not terminate the message-loop. 136 155 */ 137 156 case WM_CLOSE: … … 142 161 /* 143 162 // Window is being destroyed, time to cleanup resources allocated. 163 // This message seems only to be sent on a WinDestroyWindow() call. 164 // When clicking the close-button and not doing an explicit 165 // WinDestroyWindow() does not output the message below. 144 166 */ 145 167 case WM_DESTROY: … … 166 188 167 189 /* 168 // PmMain Selective EntryPoint.169 */ 170 int PmMain(int argc, char* argv[]) {190 // Gui EntryPoint for Presentation Manager 191 */ 192 int APIENTRY PmMain(int argc, char* argv[]) { 171 193 BOOL brc = FALSE; // Boolean return values 172 194 APIRET ulrc = -1; // Numeric return values … … 185 207 FCF_TASKLIST // Put the beast in the task-list 186 208 }; 187 PSZ pszClassClient = (PSZ) " PmMainWindow";// Window Class Name188 PSZ pszTitle = (PSZ) "ApiTestPm :: Main Window ";// Window Title209 PSZ pszClassClient = (PSZ) "ApiTestPm"; // Window Class Name 210 PSZ pszTitle = (PSZ) "ApiTestPm :: Main Window [generated:201601252233]"; // Window Title 189 211 ULONG flStyleClient = 0; // Style for Client Window 190 212 HWND hwndFrame = NULL; // Receives handle for Frame Window 191 213 HWND hwndClient = NULL; // Receives handle for Client Window 192 193 214 194 215 … … 207 228 208 229 209 210 230 /* Initialize the PM Graphics System */ 211 231 hab = WinInitialize(NULL); … … 215 235 216 236 /* Register the class of the Main Window */ 217 brc = WinRegisterClass(hab, pszClassClient, Pm WindowProc, CS_SIZEREDRAW, 0);237 brc = WinRegisterClass(hab, pszClassClient, Pm32WindowProc, CS_SIZEREDRAW, 0); 218 238 219 239 /* Create the Main Window */ … … 229 249 &hwndClient // Storage for Client Handle 230 250 ); 231 232 251 233 252 … … 250 269 printf("Continuing program...\n"); 251 270 } while (0); 252 253 271 254 272 … … 272 290 WinDispatchMsg(hab, &qmsg); 273 291 292 /* Destroy the Main Window -- causes WM_DESTROY to be sent */ 293 brc = WinDestroyWindow(hwndFrame); 294 274 295 /* Destroy the message-queue for this (main) thread */ 275 296 brc = WinDestroyMsgQueue(hmq); … … 286 307 287 308 288 /* 289 // This is the standard C/C++ EntryPoint. 309 310 /* 311 // This is the standard C/C++ EntryPoint 290 312 */ 291 313 int main(int argc, char* argv[]) { 292 314 printf("\n"); 293 315 printf("%s\n","###############################################################################"); 294 printf("%s\n","# This is the PM v ersion of ApiTest version.201512030711#");316 printf("%s\n","# This is the PM variant of ApiTest version.201601252233 #"); 295 317 printf("%s\n","###############################################################################"); 296 318 printf("\n");
Note:
See TracChangeset
for help on using the changeset viewer.
