Page 1 of 1
[PB4.6B4] OSversion()
Posted: Mon Aug 29, 2011 1:10 pm
by buzzqw
try this code on a Windows machine (tested on win7)
Code: Select all
If OSVersion()<=#PB_OS_Linux_Future
MessageRequester("OS","Linux")
EndIf
get the same message if executing
Code: Select all
If OSVersion()<=#PB_OS_Windows_Future
MessageRequester("OS","Windows")
EndIf
the first command should be true only on a Linux box...
BHH
P.S. i compile the code on windows and linux box
Re: [PB4.6B4] OSversion()
Posted: Mon Aug 29, 2011 1:14 pm
by ts-soft
This is a runtime function, you have to use compilerdirectives:
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
If OSVersion()<=#PB_OS_Linux_Future
MessageRequester("OS","Linux")
EndIf
CompilerElse
If OSVersion()<=#PB_OS_Windows_Future
MessageRequester("OS","Windows")
EndIf
CompilerEndIf
Re: [PB4.6B4] OSversion()
Posted: Mon Aug 29, 2011 2:16 pm
by DarkDragon
buzzqw wrote:the first command should be true only on a Linux box...
How the hell should that work? It would mess up all calculations in the world.
As #PB_OS_Linux_Future isn't equal with #PB_OS_Windows_Future one of them is always smaller than the other one.
Re: [PB4.6B4] OSversion()
Posted: Tue Aug 30, 2011 7:35 pm
by buzzqw
thanks ts-soft!
the help manual abot osversion don't mention this "compilerdirectives"
BHH
Re: [PB4.6B4] OSversion()
Posted: Tue Aug 30, 2011 8:49 pm
by PMV
You should only read, what is written in the help.
windows help wrote: #PB_OS_Windows_NT3_51
#PB_OS_Windows_95
#PB_OS_Windows_NT_4
#PB_OS_Windows_98
#PB_OS_Windows_ME
#PB_OS_Windows_2000
#PB_OS_Windows_XP
#PB_OS_Windows_Server_2003
#PB_OS_Windows_Vista
#PB_OS_Windows_Server_2008
#PB_OS_Windows_7
#PB_OS_Windows_Future
No linux, right? So on a windows platform, it will not output linux constants.
In the linux help there will be only #PB_OS_Linux_XXX constants.
OSVersion() is only to get the version of the used OS, not to check against
mac/linux/win. And that is, what the help says. If you want to know, what
OS is used, you need the compiler constant #PB_Compiler_OS. And if you
only want to know, if it is linux or windows, you doesn't need OSVersion()
and your program will maybe work in the future.
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
MessageRequester("OS","Linux")
CompilerElse
MessageRequester("OS","Windows")
CompilerEndIf
MFG PMV
Re: [PB4.6B4] OSversion()
Posted: Tue Aug 30, 2011 9:43 pm
by ts-soft
@PMV
your example doesn't work on my mac

Re: [PB4.6B4] OSversion()
Posted: Wed Aug 31, 2011 8:00 pm
by PMV
When im running that code on this Mac Book Pro ... it says windows ... and it's right.
