home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Win32_Samples / win32 / Keyboard / winmain.cpp < prev   
Encoding:
C/C++ Source or Header  |  1999-05-13  |  1.9 KB  |  88 lines

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2.  
  3. Copyright (c) 1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     winmain.cpp
  8.  
  9. Abstract:
  10.  
  11.     Contains the Win32 Main entry point.  Creates and initializes 
  12.     main Application class and sets up the message loop. 
  13.  
  14. Environment:
  15.  
  16.     AutoPC
  17.  
  18. -------------------------------------------------------------------*/
  19. // System specific includes
  20. #include <windows.h>
  21. #include <olectl.h>
  22. #include <asfc.h>
  23. #include <ascmnctl.h>
  24.  
  25. // Application specific includes
  26. #include "resource.h"
  27. #include "appsink.h"
  28. #include "app.h"
  29.  
  30. // Global application class object
  31. CKeyboardApp* g_pApp = NULL;
  32.  
  33. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  34. Function:
  35.     WinMain
  36.  
  37. Description:
  38.     Main Win32 entry point.  Creates and initializes main application
  39.     class.
  40.  
  41. Parameters:
  42.     Standard Win32 Arguments.
  43.  
  44. Returns:
  45.     TRUE on app exit.
  46. -------------------------------------------------------------------*/
  47. int APIENTRY 
  48. WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR szCmd, int nCmdShow)
  49. {
  50.     MSG msg;
  51.  
  52.     // Peek message to ensure that thread is ready for PostThreadMsg calls
  53.     PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
  54.  
  55.     // Create our new main application class object
  56.     g_pApp = new CKeyboardApp(hInst);
  57.  
  58.     // GoTo quit if 'new' failed.
  59.     if(!g_pApp) 
  60.         goto LReturn;
  61.  
  62.     // Call App's init function, quit if it failes.
  63.     if(!g_pApp->Init()) 
  64.         goto LReturn;
  65.  
  66.     // Message Loop
  67.     while (GetMessage(&msg, NULL, 0, 0)) 
  68.     {
  69.         if (msg.hwnd)
  70.         { 
  71.             DispatchMessage(&msg);
  72.         }
  73.         else
  74.         {
  75.             // Send any messages not directed towards main window to our
  76.             // app's ProcessMessage function
  77.             g_pApp->ProcessMessage(msg.message, msg.wParam, msg.lParam);    
  78.         }
  79.     }
  80.  
  81. LReturn:   
  82.  
  83.     if(g_pApp)
  84.         delete g_pApp;
  85.  
  86.     return TRUE; 
  87. }
  88.