Microsoft KB Archive/174561: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
(One intermediate revision by the same user not shown) | |||
Line 23: | Line 23: | ||
== SYMPTOMS == | == SYMPTOMS == | ||
The OS() function returns incorrect operating system information when executed from FoxPro for Windows 2.6x or FoxPro for MS-DOS 2.6x running under Windows NT 4.0. The OS() function returns the value DOS 05.00 for the MS-DOS version. Adding the | The OS() function returns incorrect operating system information when executed from FoxPro for Windows 2.6x or FoxPro for MS-DOS 2.6x running under Windows NT 4.0. The OS() function returns the value DOS 05.00 for the MS-DOS version. Adding the "1" switch available in the OS() function under FoxPro for Windows 2.6x should report the current version of Windows. When running under Windows NT 4.0, the OS(1) function incorrectly identifies the Windows version as Windows 3.10 | ||
<br /> | <br /> | ||
Line 34: | Line 34: | ||
CLEAR | CLEAR | ||
SET LIBRARY TO home() + | SET LIBRARY TO home() + "foxtools.fll" | ||
* WF-WINNT represented as the 0-based bit number that must be on | * WF-WINNT represented as the 0-based bit number that must be on | ||
Line 41: | Line 41: | ||
WF_WINNT = 14 | WF_WINNT = 14 | ||
m.getwinflags = RegFN( | m.getwinflags = RegFN("GetWinFlags", "", "L") | ||
m.retval = callfn(m.getwinflags) | m.retval = callfn(m.getwinflags) | ||
IF testbit(m.retval, WF_WINNT) | IF testbit(m.retval, WF_WINNT) | ||
? | ? "Running NT" | ||
ELSE | ELSE | ||
? | ? "Not running NT" | ||
ENDIF | ENDIF | ||
Line 116: | Line 116: | ||
For additional information, please see the following articles in the Microsoft Knowledge Base: | For additional information, please see the following articles in the Microsoft Knowledge Base: | ||
<blockquote>[[ | <blockquote>[[../122353|Q122353]] How to Determine If a VB App is Running Under Windows NT 3.x</blockquote> | ||
<blockquote>[[mk:@MSITStore:kbwindev.chm::/Source/win16sdk/q131371|Q131371]] Determining System Version from a Windows-Based Application</blockquote> | <blockquote>[[mk:@MSITStore:kbwindev.chm::/Source/win16sdk/q131371|Q131371]] Determining System Version from a Windows-Based Application</blockquote> | ||
Additional query words: OS | Additional query words: OS |
Latest revision as of 11:07, 21 July 2020
The information in this article applies to:
SYMPTOMSThe OS() function returns incorrect operating system information when executed from FoxPro for Windows 2.6x or FoxPro for MS-DOS 2.6x running under Windows NT 4.0. The OS() function returns the value DOS 05.00 for the MS-DOS version. Adding the "1" switch available in the OS() function under FoxPro for Windows 2.6x should report the current version of Windows. When running under Windows NT 4.0, the OS(1) function incorrectly identifies the Windows version as Windows 3.10
RESOLUTIONIn FoxPro for Windows 2.6x, you can use the GetWinFlags API to determine whether the application is running on Windows NT 4.0. The code example sends a message to the FoxPro desktop indicating whether Windows NT is the current operating system. It does not include the version of NT. Since the code includes Windows API calls, it will not work in FoxPro for MS-DOS. **** Begin Code Example**** CLEAR SET LIBRARY TO home() + "foxtools.fll" * WF-WINNT represented as the 0-based bit number that must be on * in the returned WinFlags() for the program to be running under NT. WF_WINNT = 14 m.getwinflags = RegFN("GetWinFlags", "", "L") m.retval = callfn(m.getwinflags) IF testbit(m.retval, WF_WINNT) ? "Running NT" ELSE ? "Not running NT" ENDIF ***************** * function testbit - determines if a specific bit of a passed number is * on/off * * passed: number (m.number) * bit number (m.bitnum, 0 - 31) * * returns: .f. for off, .t. for on, .f. for illegal function call **************** FUNCTION testbit PARAMETERS m.number, m.bitnum * number too big - exit IF NOT BETWEEN(m.bitnum, 0, 31) RETURN .F. ENDIF m.ascii = m.number FOR i = 31 TO 0 STEP -1 m.newascii = MOD(m.ascii, 2 ^ i) IF m.bitnum = i IF m.newascii # m.ascii RETURN .T. ELSE RETURN .F. ENDIF ENDIF m.ascii = m.newascii NEXT **** End Code Example****
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONThe OS() function differs slightly between FoxPro for MS-DOS and FoxPro for Windows 2.6x. In FoxPro for Windows, the OS() function has an optional parameter of 1. This returns the version of Windows. The OS() function simply returns the MS-DOS operating system version. Steps to Reproduce Behavior
REFERENCESFor additional information, please see the following articles in the Microsoft Knowledge Base:
Additional query words: OS Keywords : FoxDos FoxWin FxprgGeneral Version : MS-DOS:2.6,2.6a; WINDOWS:2.6,2.6a Platform : MS-DOS winnt Issue type : kbbug |
Last Reviewed: August 2, 1999 |