Michael,
Try This:
***************
* Start of Code
*
? GetWindowsVersion()
Return
****************************************************************************
* PROCEDURE NAME: GETWINVERSION.PRG
*
* AUTHOR: axk
*
* PROCEDURE DESCRIPTION: Returns version of Windows OS
*
* INPUT PARAMETERS:
* None
*
* OUTPUT PARAMETERS:
* None
*
****************************************************************************
****************************************************************************
Function GetWindowsVersion()
Declare Integer GetVersionEx in kernel32 String@
local lcOs, lnRes, lnmajor, lnminor, lnbuild, lnplatform, lcaddinfo,
lcReturn
* create a string buffer large enough to hold a OSVERSIONINFO structure
* The first 4-bytes are used to determine the size of the string
lcOs = NumtoDWord(148) + replicate(chr(0),144)
lnRes = GetVersionEx(@lcOs)
lcReturn = ''
if lnRes # 0 then
lnmajor = DWordtoNum(substr(lcOs,5,4))
lnminor = DWordtoNum(substr(lcOs,9,4))
lnbuild = DWordtoNum(substr(lcOs,13,4))
lnplatform = DWordtoNum(substr(lcOs,17,4))
lcaddinfo = substr(lcOs,21) && For NT - service pack info
lcaddinfo = left(lcaddinfo,at(chr(0),lcaddinfo)-1)
do case
case lnplatform = 1
do case
case lnminor = 10
lcReturn = "Windows 98"
otherwise
lcReturn = "Windows 95"
endcase
case lnplatform = 2
do case
case lnmajor = 5
Do case
Case lnMinor>=1
lcReturn ="Windows XP " + lcaddinfo
*
otherwise
lcReturn = "Windows 2000 " + lcaddinfo
EndCase
*
case lnmajor = 4
lcReturn = "Windows NT 4.0 " + lcaddinfo
otherwise
lcReturn = "Windows NT 3.51 " + lcaddinfo
endcase
endcase
endif
return lcReturn
EndFunc
function NumtoDWord
lparameter tnNum
local c0,c1,c2,c3
lcresult = chr(0)+chr(0)+chr(0)+chr(0)
if tnNum < (2^31 - 1) then
c3 = chr(int(tnNum/(256^3)))
tnNum = mod(tnNum,256^3)
c2 = chr(int(tnNum/(256^2)))
tnNum = mod(tnNum,256^2)
c1 = chr(int(tnNum/256))
c0 = chr(mod(tnNum,256))
lcresult = c0+c1+c2+c3
else
* not a valid number for a DWORD value
endif
return lcresult
function DwordToNum
lparameter tcDWORD
local ln0,ln1,ln2,ln3
ln0=asc(subs(tcDWORD,1,1))
ln1=asc(subs(tcDWORD,2,1)) * (256)
ln2=asc(subs(tcDWORD,3,1)) * (256^2)
ln3=asc(subs(tcDWORD,4,1)) * (256^3)
return ln3 + ln2 + ln1 + ln0
*
* End of Code
*************
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Michael J. Babcock, MCP
Sent: 13 February 2008 16:06
To: [email protected]
Subject: WinXP Home vs. Professional -- identifying difference in code?
According to the Fox Wiki, when calling OS(), both WinXP Home and
Professional both return Windows 5.01. It looks like I can use OS(10) and
check to see if the value returned is 512, but wanted to know if others
have used a different technique or can comment on this approach?
Our software here apparently isn't supported on WinXP Home (but is on
Professional). We can prevent installation on WinXP Home in the
Installshield setup, but I was thinking it might be a good idea to stick a
check in the main.prg via code as well.
For example, I think this will do:
if OS() = "Windows 5.01" and OS(10) = 512 then
messagebox("Sorry dude...you shouldn't be running this under WinXP
Home.")
quit
endif
Comments welcome! Thanks in advance.
--Michael
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.