Determining Windows Version, Mode from MS-DOS AppLast reviewed: July 23, 1997Article ID: Q75338 |
3.10
WINDOWS
kbprg
The information in this article applies to:
SUMMARYThe following assembly language code fragment can be used in an MS-DOS- based application to determine if it is running in a Windows MS-DOS window, and if so, which version and mode of Windows is running. test_win proc near ; check for Windows 3.1
mov ax,160ah ; WIN31CHECK int 2fh ; check if running under Win 3.1. or ax,ax jz RunningUnderWin31 ; can check if running in standard ; or enhanced mode; check for Windows 3.0 enhanced mode
mov ax,1600h ; WIN386CHECK int 2fh test al,7fh jnz RunningUnderWin30Enh ; enhanced mode; check for 3.0 WINOLDAP
mov ax,4680h ; IS_WINOLDAP_ACTIVE int 2fh or ax,ax ; running under 3.0 derivative? jnz NotRunningUnderWin; rule out MS-DOS 5.0 task switcher
mov ax,4b02h ; detect switcher push bx push es push di xor bx,bx mov di,bx mov es,bx int 2fh pop di pop es pop bx or ax,ax jz NotRunningUnderWin ; MS-DOS 5.0 task switcher found; check for standard mode Windows 3.0
mov ax,1605h ; PMODE_START int 2fh cmp cx,-1 jz RunningUnderWin30Std; check for real mode Windows 3.0
mov ax,1606h ; PMODE_STOP int 2fh ; in case someone is counting ; Real mode Windows 3.0 is running jmp NotRunningUnderWinRunningUnderWin30Std:
; Standard mode Windows 3.0 is running jmp NotRunningUnderWinRunningUnderWin31:
; At this point: CX == 3 means Windows 3.1 enhanced mode ; CX == 2 means Windows 3.1 standard mode jmp NotRunningUnderWinRunningUnderWin30Enh:
; Enhanced mode Windows 3.0 is runningNotRunningUnderWin:
rettest_win endp
MORE INFORMATIONApplications for Windows should use the GetWinFlags() function to determine which version of Windows is running. For more information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q131371 TITLE : Determining System Version from a Windows-Based Application |
Additional reference words: 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |