home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / SHUTDWN5.ZIP / SHUTDOWN.C < prev    next >
C/C++ Source or Header  |  1993-04-24  |  1KB  |  38 lines

  1. #define INCL_PM
  2. #include <OS2.H>
  3. /*
  4.   ┌───────────────────────────────────────────────────────────────┐
  5.   │ PMSW program entry                                            │
  6.   └───────────────────────────────────────────────────────────────┘
  7. */
  8.  void main ( void)
  9.  {
  10.  HAB       hAnchorBlock;    /* Anchor-block handle */
  11.  int       iRC=0;           /* return code from program */
  12.  ULONG     ulRetCode=0;     /* Return code *from Win* functions */
  13.  ULONG     ulSendResult=0;  /* Return code *from Win* functions */
  14.  HMQ       hMsgQWindow;
  15.  QMSG      rMsgQWin;
  16.  QMSG      rMsgDESK;
  17.  
  18.  if (( hAnchorBlock = WinInitialize( 0UL )) == NULLHANDLE)
  19.    return;
  20.  if ((hMsgQWindow=WinCreateMsgQueue(hAnchorBlock, 0UL))== NULLHANDLE)
  21.    return;
  22.  rMsgDESK.hwnd=HWND_DESKTOP;
  23.  rMsgDESK.msg=0;
  24.  rMsgDESK.mp1=MPVOID;
  25.  rMsgDESK.mp2=MPVOID;
  26.  rMsgDESK.time=0;
  27.  rMsgDESK.reserved=0;
  28.  ulSendResult=WinBroadcastMsg(HWND_DESKTOP,
  29.    WM_SYSCOMMAND,
  30.    MPFROMSHORT(SC_CLOSE),
  31.    MPFROM2SHORT(CMDSRC_MENU,FALSE),
  32.    (ULONG) BMSG_FRAMEONLY);
  33.  WinShutDownSystem(HWND_DESKTOP,rMsgDESK);
  34.  WinDestroyMsgQueue(hMsgQWindow); /* Destroy message queue   */
  35.  WinTerminate(hAnchorBlock);    /* Deregister application    */
  36.  return;
  37. }
  38.