Differences
This shows you the differences between two versions of the page.
| en:docs:win16:api:user:oldexitwindows [2026/02/18 02:03] – created prokushev | en:docs:win16:api:user:oldexitwindows [2026/04/30 06:06] (current) – prokushev | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| {{page> | {{page> | ||
| - | ====== | + | ====== |
| ===== Brief ===== | ===== Brief ===== | ||
| + | |||
| + | The **OldExitWindows** function immediately terminates the entire Windows session by directly invoking the DOS " | ||
| ===== Syntax ===== | ===== Syntax ===== | ||
| + | <code c>void FAR PASCAL OldExitWindows(void);</ | ||
| ===== Parameters ===== | ===== Parameters ===== | ||
| + | This function takes no parameters. | ||
| ===== Return Code ===== | ===== Return Code ===== | ||
| + | This function does not return. Control is passed directly to MS‑DOS, and the Windows environment is forcibly terminated. | ||
| ===== Notes ===== | ===== Notes ===== | ||
| + | * **OldExitWindows** performs a " | ||
| + | * Because of its abrupt nature, using this function can lead to data loss or file corruption in applications that rely on proper termination handling. | ||
| + | * The function is a legacy entry point from Windows 2.1. It is retained in Windows 3.0 and 3.1 under the name **OldExitWindows** to provide binary compatibility for old applications. | ||
| + | * New programs should use the documented **ExitWindows** function for a controlled shutdown that allows applications to veto the exit. | ||
| + | * **OldExitWindows** is exported by **USER.EXE** both by name and by ordinal 2. | ||
| + | * Support: Windows 3.0, Windows 3.1. | ||
| ===== Example Code ===== | ===== Example Code ===== | ||
| ==== C Binding ==== | ==== C Binding ==== | ||
| + | <code c> | ||
| + | #include < | ||
| + | |||
| + | int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, | ||
| + | LPSTR lpCmdLine, int nCmdShow) | ||
| + | { | ||
| + | // Optional confirmation dialog before the hard exit. | ||
| + | int result = MessageBox(NULL, | ||
| + | "This will immediately exit Windows without saving. Continue?", | ||
| + | " | ||
| + | MB_YESNO | MB_ICONWARNING); | ||
| + | |||
| + | if (result == IDYES) | ||
| + | { | ||
| + | // Perform an unconditional, | ||
| + | OldExitWindows(); | ||
| + | } | ||
| + | |||
| + | // If the user chose " | ||
| + | return 0; | ||
| + | } | ||
| + | </ | ||
| ==== MASM Binding ==== | ==== MASM Binding ==== | ||
| + | <code asm> | ||
| + | |||
| + | .MODEL LARGE | ||
| + | .386 | ||
| + | |||
| + | INCLUDE windows.inc | ||
| + | |||
| + | .CODE | ||
| + | START PROC FAR | ||
| + | |||
| + | ; Call OldExitWindows – never returns | ||
| + | call OldExitWindows | ||
| + | |||
| + | START ENDP | ||
| + | |||
| + | END START | ||
| + | </ | ||
| ===== See also ===== | ===== See also ===== | ||
| + | * [[ExitWindows]] | ||
| + | * [[ExitWindowsExec]] | ||
| + | * [[PostQuitMessage]] | ||
| + | * [[WM_QUERYENDSESSION]] | ||
| + | * [[WM_ENDSESSION]] | ||
| {{page> | {{page> | ||
| - | |||




