Given the window handle and the message queue handle, the following code fragment shows how to shut down the system:
BOOL rc; HAB hab; HMQ hmq; { hab = WinQueryAnchorBlock(hwnd); rc = WinShutDownSystem(hab, hmq); if (rc) { /* System shutdown successfully */ } else { /* WinShutDownSystem failed */ } }