 |
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
pingoleo
註冊時間: 2004-04-12 文章: 92
第 1 樓
|
發表於: 星期四 五月 06, 2004 3:06 pm 文章主題: xp,me ,98,2000 |
|
|
請問有什麼辦法可以判斷目前的作業系統? |
|
回頂端 |
|
 |
syntech
註冊時間: 2003-05-16 文章: 4249 來自: Taipei,Taiwan
第 2 樓
|
發表於: 星期四 五月 06, 2004 3:46 pm 文章主題: |
|
|
Knowledge Base
HOWTO: Determine the Operating System Build NumberPSS ID Number: 188987
Article Last Modified on 5/22/2003
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Visual FoxPro for Windows 3.0
Microsoft Visual FoxPro for Windows 3.0b
Microsoft Visual FoxPro for Windows 5.0
Microsoft Visual FoxPro for Windows 5.0a
--------------------------------------------------------------------------------
This article was previously published under Q188987
SUMMARY
Visual FoxPro's OS() function allows you to determine the major and minor versions of the host operating system. To determine the operating system build number programmatically, you must use the GetVersionEx() application programming interface (API) call.
NOTE: The GetVersionEx() function, when run under Visual FoxPro 3.0 or 3.0b on 16-bit Windows, can return the Win32s version and build numbers.
MORE INFORMATION
Run the following sample program. A message box containing the major and minor version, the text name of the host operating system and the build number displays. Here is the sample code:
#DEFINE VER_PLATFORM_WIN32S 0
#DEFINE VER_PLATFORM_WIN32_WINDOWS 1
#DEFINE VER_PLATFORM_WIN32_NT 2
#DEFINE FFFF 65535
#DEFINE CR CHR(13)
DECLARE GetVersionEx IN win32api STRING @OSVERSIONINFO
* The OSVERSIONINFO structure is 148 bytes long.
m.osversion = long2str(148) + REPLICATE(CHR(0), 144)
=GetVersionEx(@m.osversion)
m.major = str2long(SUBSTR(m.osversion, 5, 4))
m.minor = str2long(SUBSTR(m.osversion, 9, 4))
m.build = str2long(SUBSTR(m.osversion, 13, 4))
m.platform = str2long(SUBSTR(m.osversion, 17, 4))
m.spversion = STRTRAN(SUBSTR(m.osVersion, 21), CHR(0), "")
m.platformname = ""
DO CASE
CASE m.platform = VER_PLATFORM_WIN32S
m.platformname = "Win32s on Windows 3.1"
CASE m.platform = VER_PLATFORM_WIN32_WINDOWS
m.platformname = "Win32 on Windows 9x"
CASE m.platform = VER_PLATFORM_WIN32_NT
m.platformname = "Windows NT/2000"
ENDCASE
* Build must be ANDed with FFFFh per Microsoft Knowledge Base
* Article, Q92395.
m.build = BITAND(m.build, FFFF)
=MESSAGEBOX("Major version:" + STR(m.major) + CR + ;
"Minor version: " + STR(m.minor) + CR + ;
"Supported platform: " + STR(m.platform) + ;
" (" + m.platformname + ")" + CR + ;
"Build number: " + STR(m.build) + ;
IIF(NOT EMPTY(m.spversion), ;
CR + m.spVersion, ""), ;
0 + 64 + 0, ;
"GetVersionEx() results")
* Function long2str - convert 4-byte integer into low-high format
* Character string.
FUNCTION long2str
PARAMETERS m.longval
PRIVATE i, m.retstr
m.retstr = ""
FOR i = 24 TO 0 STEP -8
m.retstr = CHR(INT(m.longval/(2^i))) + m.retstr
m.longval = MOD(m.longval, (2^i))
NEXT
RETURN m.retstr
* Function STR2LONG - convert lo-high ascii character representation
* into 4-byte integer.
FUNCTION str2long
PARAMETERS m.longstr
PRIVATE i, m.retval
m.retval = 0
FOR i = 0 TO 24 STEP 8
m.retval = m.retval + (ASC(m.longstr) * (2^i))
m.longstr = RIGHT(m.longstr, LEN(m.longstr) - 1)
NEXT
RETURN m.retval
REFERENCES
For additional information about checking system versions, please see the GetVersion() and GetVersionEx() API documentation in the Windows System Information section of the Platform SDK documentation.
Additional query words: GetVersionEx kbnokeyword
Keywords: kbCodeSnippet kbhowto KB188987
Technology: kbAudDeveloper kbVFP300 kbVFP300b kbVFP500 kbVFP500a kbVFPsearch
--------------------------------------------------------------------------------
Send feedback to Microsoft
© 2004 Microsoft Corporation. All rights reserved. _________________ 如果公司有下列困擾:
1. 找不到便宜,快速,簡易的 生產排程軟體
2. 不知道如何快速排定 採購計劃
3. 成本抓不準,自己算比軟體算有用
4. 想學習系統規劃,想找系統架構的顧問
請聯絡我們,也許我們幫得上忙 |
|
回頂端 |
|
 |
syntech
註冊時間: 2003-05-16 文章: 4249 來自: Taipei,Taiwan
第 3 樓
|
發表於: 星期四 五月 06, 2004 3:47 pm 文章主題: |
|
|
OS( ) Function
Example See Also
Returns the name and version number of the operating system under which Microsoft Visual FoxPro is running.
Syntax
OS([1 | 2])
Returns
Character
Arguments
1
Specifies that the name and version number of the operating system is returned.
2
Specifies that a character string indicating if the operating system supports DBCS (double-byte character sets) is returned If DBCS is supported, the character string “DBCS” is returned, otherwise the empty string is returned.
Remarks
If the optional 1 or 2 argument is omitted, the underlying operating system name and its version number is returned. _________________ 如果公司有下列困擾:
1. 找不到便宜,快速,簡易的 生產排程軟體
2. 不知道如何快速排定 採購計劃
3. 成本抓不準,自己算比軟體算有用
4. 想學習系統規劃,想找系統架構的顧問
請聯絡我們,也許我們幫得上忙 |
|
回頂端 |
|
 |
pingoleo
註冊時間: 2004-04-12 文章: 92
第 4 樓
|
發表於: 星期四 五月 06, 2004 5:25 pm 文章主題: |
|
|
了解,感謝你~~~ |
|
回頂端 |
|
 |
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|