How can I detect what OS version is running from?

Just starting out? Need help? Post your questions and find answers here.
Kris_a
User
User
Posts: 92
Joined: Sun Feb 15, 2004 8:04 pm
Location: Manchester, UK

Post by Kris_a »

Sorry, I saw this and just had to improve it...!!

Code: Select all

Procedure.l GetOSVersion() 
  Vers.l = OSVersion()

  select vers
    case #PB_OS_Windows_NT3_51
      procedurereturn 1
    case #PB_OS_Windows_95
      procedurereturn 2
    case #PB_OS_Windows_NT_4
      procedurereturn 3
    case #PB_OS_Windows_98
      procedurereturn 4
    case #PB_OS_Windows_ME
      procedurereturn 5
    case #PB_OS_Windows_2000
      procedurereturn 6
    case #PB_OS_Windows_XP
      procedurereturn 7
    case #PB_OS_Windows_Future
      procedurereturn 8
  endselect  

  procedurereturn -1
EndProcedure
DriakTravo
Enthusiast
Enthusiast
Posts: 346
Joined: Fri Oct 10, 2003 12:42 am
Location: Tampa,FL,USA
Contact:

Post by DriakTravo »

LoL, thanks for improving my code, I am still kinda new to programming and still don't know the most efficient way of doing things. I was just trying to make sence out of the OSVersion()
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I was just trying to make sence out of the OSVersion()

These two examples were made directly from the manual/help:

Code: Select all

Select OSVersion()
  Case #PB_OS_Windows_NT3_51 : Debug "You are running NT 3.51"
  Case #PB_OS_Windows_95 : Debug "You are running 95"
  Case #PB_OS_Windows_NT_4 : Debug "You are running NT 4"
  Case #PB_OS_Windows_98 : Debug "You are running 98"
  Case #PB_OS_Windows_ME : Debug "You are running ME"
  Case #PB_OS_Windows_2000 : Debug "You are running 2000"
  Case #PB_OS_Windows_XP : Debug "You are running XP"
  Case #PB_OS_Windows_Future : Debug "You are running Unknown"
EndSelect

Code: Select all

If OSVersion()=>#PB_OS_Windows_98
  Debug "You are running 98 or higher."
EndIf
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

GPI wrote:
@GPI
Why you had to say badwords just for that? :(
Some Standard "Words":

Code: Select all

AFAIK : as far as i know
BTW: by the way
FAQ(S): Frequently asked question(s)
FUP(2): Floow up (to)
IM([NS]H)O: in my([not so] humble) opinion
LOL: laughing out loud
OT: off topic
Q&A: questions and answers
RTFL: rolling on the floor laughing
RT(F)M: read the (fucking) manual
THX: thanks
TIA: thanks in advance
Freak said, that you should see in the help-file about "osversion()" and then you ask for something, which stand in the help-file.
Hmm, and I've been using rofl all these years.. ;)

Code: Select all

ROFL: rolling on the floor laughing
- john
Fred
Administrator
Administrator
Posts: 16684
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I don't see the point of the 'GetOSVersion()' wrapper. The PB constants are already sorted in this order and are much more explanatory than using 1, 2, 3, 4 or wathever :)
DriakTravo
Enthusiast
Enthusiast
Posts: 346
Joined: Fri Oct 10, 2003 12:42 am
Location: Tampa,FL,USA
Contact:

Post by DriakTravo »

LMAO: Laugh my ass off
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

and to combine a couple, for the ultimate:
ROFLMAO - Rolling On the Floor Laughing My Ass Off

:lol: :wink:

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post by merendo »

*lol* can also mean: Lots of Laughs
The truth is never confined to a single number - especially scientific truth!
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

Code: Select all

OS = Val(Bin(OSVersion()))

Select OS
  Case 101
    Debug "Windows NT 3.51"
  Case 1010
    Debug "Windows 95"
  Case 10100
    Debug "Windows NT 4.0"
  Case 11110
    Debug "Windows 98"
  Case 101000
    Debug "Window ME"
  Case 110010
    Debug "Windows 2000"
  Case 111100
    Debug "Windows XP"
  Case 1100100
    Debug "Future Version of Windows"
  Default
    Debug "Hmmm?"
EndSelect
rofl

- np
DriakTravo
Enthusiast
Enthusiast
Posts: 346
Joined: Fri Oct 10, 2003 12:42 am
Location: Tampa,FL,USA
Contact:

Post by DriakTravo »

Default
Debug "Hmmm?"
ROFLMAO!!!!! ;)
Soulfire
User
User
Posts: 23
Joined: Mon Mar 08, 2004 7:17 am

Post by Soulfire »

Code: Select all

Select OSVersion() 
  Case #PB_OS_Windows_NT3_51 : Debug "lmfao" 
  Case #PB_OS_Windows_95     : Debug "rofl" 
  Case #PB_OS_Windows_NT_4   : Debug "lol" 
  Case #PB_OS_Windows_98     : Debug "stfu" 
  Case #PB_OS_Windows_ME     : Debug "smd" 
  Case #PB_OS_Windows_2000   : Debug "nm" 
  Case #PB_OS_Windows_XP     : Debug "gj" 
  Case #PB_OS_Windows_Future : Debug "wtf?" 
EndSelect 
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

is it me or is this topic is way off
~Dreglor
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

Dreglor wrote:is it me or is this topic is way off
It's probably just you... :lol:

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

Dreglor wrote:is it me or is this topic is way off

Code: Select all

Declare.l IsTopicWayOff()

Enumeration
  #_No
  #_Yes
EndEnumeration

If IsTopicWayOff() = #_Yes
  Debug "Maybe just a little..."
Else
  Debug "Nah.. "
EndIf

End



Procedure.l IsTopicWayOff()
  hmm = Random(1)
  If hmm = 0
    ProcedureReturn #_No
  Else
    ProcedureReturn #_Yes
  EndIf
EndProcedure
- np

omg
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Oooo! 8O I think that... we got the point about the command 8)
Hey guys I just wanted to know why it gave 60.
Post Reply