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

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2.  
  3. Copyright (c) 1998 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     winmain.cpp
  8.  
  9. Abstract:
  10.  
  11.     WinMain entry point for SR sample app.  Creates and inits main
  12.     application class and contains the message loop.
  13.  
  14. Environment:
  15.  
  16.     AutoPC
  17.  
  18. -------------------------------------------------------------------*/
  19. #include <windows.h>
  20. #include <olectl.h>
  21. #include <asfc.h>
  22. #include <ascmnctl.h>
  23.  
  24. #define APCDBG_INIT "SR App"    // Define used for debug
  25. #include <apcdebug.h>
  26.  
  27. #include "resource.h"
  28. #include "appsink.h"
  29. #include "app.h"
  30.  
  31. // Global App object
  32. extern CSRApp* g_pApp;
  33.  
  34. //+-------------------------------------------------------------------------
  35. //
  36. //    Function: WinMain
  37. //
  38. //    Synopsis: Main Win32 entry point
  39. //
  40. //    Arguments: Standard Win32 WinMain arguments
  41. //
  42. //     Returns:  TRUE on app exit
  43. //
  44. //---------------------------------------------------------------------------
  45. int APIENTRY WinMain(HINSTANCE hInst, 
  46.                      HINSTANCE hPrevInst, 
  47.                      LPWSTR szCmd, 
  48.                      int nCmdShow)
  49. {
  50.     MSG         msg;
  51.     
  52.     // Create new application object
  53.     g_pApp = new CSRApp(hInst);
  54.  
  55.     if(!g_pApp) 
  56.     {
  57.         DEBUGMSG(ZONE_ERROR, (L"SRApp: Ran out of memory allocation main Application class object"));
  58.         goto LReturn;
  59.     }
  60.  
  61.     if(!(g_pApp->Init())) 
  62.     {
  63.         DEBUGMSG(ZONE_ERROR, (L"SRApp: Application Init() failed.\n"));
  64.         goto LReturn;
  65.     }
  66.  
  67.     // Main message loop.
  68.     while(GetMessage(&msg, NULL, 0, 0)) 
  69.     {
  70.         DispatchMessage(&msg);
  71.     }
  72.  
  73. LReturn:   
  74.  
  75.     if(g_pApp)
  76.         delete g_pApp;
  77.  
  78.     return TRUE; 
  79. }
  80.