home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / IJB20OS2 / SOURCE / WIN32.C < prev   
C/C++ Source or Header  |  1997-09-16  |  655b  |  34 lines

  1. char *win32_rcs = "$Id: win32.c,v 1.4 1997/09/08 14:05:05 ACJC Exp $";
  2. #ifdef _WIN32
  3.  
  4. #include <windows.h>
  5.  
  6. /*This is called by Windows when the system is shut down or the user
  7.  logs off.*/
  8. BOOL WINAPI OnEvent(DWORD dwCtrlType)
  9. {
  10.     ExitProcess(0);
  11.  
  12.     return TRUE;    /* never reached */
  13. }
  14.  
  15. extern int hideConsole;
  16. void InitWin32()
  17. {
  18.     WORD wVersionRequested;
  19.     WSADATA wsaData;
  20.  
  21.     SetConsoleCtrlHandler(OnEvent, TRUE);
  22.     SetProcessShutdownParameters(0x280, SHUTDOWN_NORETRY);
  23.     if (hideConsole) {
  24.         FreeConsole();
  25.     }
  26.  
  27.     wVersionRequested = MAKEWORD(2, 0);
  28.     if (WSAStartup(wVersionRequested, &wsaData) != 0) {
  29.         exit(1);
  30.     }
  31. }
  32.  
  33. #endif
  34.