Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to detect which OS 's under runnig myapp.exe
Message
De
23/09/2003 15:29:44
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00831450
Message ID:
00831650
Vues:
16
Hi Soykan,

I usually one of the two below:
CLEAR
*Example 1
set talk off
lcPlatform = "(Unknown)"
#IF ! 'VISUAL' $ UPPER(VERSION())
	lcOS = OS()
	? os()
#ELSE
	lcOS = OS(1)
	? OS(1)
#ENDIF
DO CASE
  CASE "5.01" $ lcOS
     lcPlatform = "WINXP"
  CASE "5.0" $ lcOS
     lcPlatform = "WIN2000"
  CASE "NT" $ lcOS
     lcPlatform = "WINNT"
  CASE "4.0" $ lcOS OR "3.9" $ lcOS
     lcPlatform = "WIN95"
  CASE "4.1" $ lcOS
     lcPlatform = "WIN98"
  CASE "4.9" $ lcOS
     lcPlatform = "WINME"
  CASE "3." $ lcOS
     lcPlatform = "WIN31"
ENDCASE

? lcPlatform

*Example 2
#DEFINE VER_PLATFORM_WIN32S         0
#DEFINE VER_PLATFORM_WIN32_WINDOWS  1
#DEFINE VER_PLATFORM_WIN32_NT       2

DECLARE RtlMoveMemory IN WIN32API ;
	INTEGER @DestNumeric, ;
	STRING @pVoidSource, ;
	INTEGER nLength

declare short GetVersionEx in win32API ;
  string @ lpVersionInfo 
lpVersionInfo = chr(128+5*4)+replicate(chr(0),128+5*4-1)

? GetVersionEx(@lpVersionInfo)

? 'Major version :',  DWord2Str(lpVersionInfo, 5)
? 'Minor version :',  DWord2Str(lpVersionInfo, 9)
? 'Build number  :',  DWord2Str(lpVersionInfo, 13)
? 'Platform id   :',  DWord2Str(lpVersionInfo, 17)


function DWord2Str
lparameters tcStr, tnOffsett
local lnValue
lnValue=0
RtlMoveMemory(@lnValue, substr(tcStr,tnOffsett,4), 4)
return lnValue
Of course, you could always just do something like this too:

? UPPER(GETENV('OS'))


>Hi All,
>i've a backup-restore utility form . i wantto detect which OS's under running myapp.exe (under win9.x or NT/2000/XP) because i'll enabled-disabled some options on the form . How can i do this ?
>
>TIA
>
>PS: OS() gives me "Windows 5.00" , how is the others win9.x or NT or ME or XP ?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform