This is part of Win16 API which allow to create versions of program from one source code to run under OS/2 and Win16. Under OS/2 program can be running under Win-OS/2 if program is Windows NE executable, and with help on Windows Libraries for OS/2, if it is OS/2 NE executable. Here is a WLO to OS/2 API mapping draft
The PostQuitMessage function posts a message to Windows indicating that an application is requesting to terminate execution (quit). This function is typically used in response to a `WM_DESTROY` message.
VOID WINAPI PostQuitMessage(int nExitCode);
This function does not return a value.
#include <windows.h> LRESULT CALLBACK __export WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd, msg, wParam, lParam); } int WINAPI WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; /* ... window class registration and creation ... */ while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; }
EXTRN PostQuitMessage:FAR WndProc PROC FAR cmp ax, WM_DESTROY je handle_destroy ; ... other messages ... handle_destroy: push 0 ; nExitCode = 0 call PostQuitMessage xor ax, ax ; return 0 (message handled) retf WndProc ENDP ; Message loop that catches WM_QUIT WinMain PROC FAR ; ... initialization ... message_loop: lea ax, msg push ax ; lpMsg push 0 ; hWnd push 0 ; wMsgFilterMin push 0 ; wMsgFilterMax call GetMessage cmp ax, 0 je exit_app ; FALSE — WM_QUIT received lea ax, msg push ax call TranslateMessage lea ax, msg push ax call DispatchMessage jmp message_loop exit_app: mov ax, msg.wParam ; return exit code from WM_QUIT retf WinMain ENDP