home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / owlsrc.pak / WINMAIN.CPP < prev   
Encoding:
C/C++ Source or Header  |  1997-07-24  |  1.3 KB  |  39 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1991, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Implementation of WinMain for user exes
  6. //----------------------------------------------------------------------------
  7. #include <owl/owlpch.h>
  8. #include <owl/applicat.h>
  9. #include <osl/locale.h>
  10.  
  11. DIAG_DEFINE_GROUP_INIT(OWL_INI, OwlMain, true, 0);
  12.  
  13. //
  14. // Default WinMain calls OwlMain, after setting params into TApplication
  15. //
  16. int PASCAL
  17. WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char far* cmdLine, int cmdShow)
  18. {
  19.   TRACEX(OwlMain, 0, "WinMain(" << hex << uint(hInstance) << ", " << 
  20.                                   hex << uint(hPrevInstance) << ", \"" << 
  21.                                   TResId(cmdLine) << "\", " << 
  22.                                   cmdShow << ") called");
  23.  
  24.   // If no global ::Module ptr exists yet, provide a default now
  25.   //
  26.   if (!::Module) {
  27.     static TModule module(0, hInstance);
  28.     ::Module = &module;
  29.   }
  30.   
  31.   TApplication::SetWinMainParams(hInstance, hPrevInstance, cmdLine, cmdShow);
  32.   TRY {
  33.     int retVal = OwlMain(_argc, _argv);
  34.     TRACEX(OwlMain, 0, "WinMain() returns " << retVal);
  35.     return retVal;
  36.   }
  37.   CATCH( (xmsg& x) {return ::HandleGlobalException(x, 0);} )
  38. }
  39.