Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 935 Bytes

sample_022.md

File metadata and controls

40 lines (31 loc) · 935 Bytes

主页

操作系统的版本和修订版

翻译:xinjie 2021.01.03

代码:

DECLARE INTEGER GetVersion IN kernel32

DECLARE SHORT StrToIntEx IN Shlwapi;
	STRING pszString, INTEGER dwFlags, INTEGER @pllRet

lnVersion = GetVersion()

* 低位
lnVersionLo = BitRShift(BitLShift(lnVersion, 16), 16)
? "主要版本: ", BitAnd(lnVersionLo, hex2dec("0x00ff"))
? "次要版本: ", BitRShift(BitAnd(lnVersionLo, hex2dec("0xff00")), 8)
?

* 高位
lnVersionHi = BitRShift(BitAnd(lnVersion, hex2dec("0xffff0000")), 16)
? lnVersionHi

FUNCTION  hex2dec (lcHex)
#DEFINE STIF_SUPPORT_HEX           1
	LOCAL lnRet
	lnRet = 0
	IF StrToIntEx (lcHex, STIF_SUPPORT_HEX, @lnRet) = 1
		RETURN lnRet
	ELSE
		RETURN 0
	ENDIF  

函数列表:

GetVersion
StrToIntEx