Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacClassic/SystemVersion
This example is the version from Sun, 17th Mar 2012.
Project "SystemVersion.xojo_binary_project"
FileTypes
Filetype text
End FileTypes
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
EventHandler Sub Open()
dim s as MacSystemVersion
s=new MacSystemVersion
StaticText2.text=s.name
End EventHandler
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
Class MacSystemVersion
Sub Constructor()
dim l as integer
dim major,minor,bug as integer
if System.Gestalt("sys1",major) then
if System.Gestalt("sys2",minor) then
if System.Gestalt("sys3",bug) then
valid=true
Third=bug
second=minor
first=major
Return
end if
end if
end if
if System.Gestalt("sysv",l) then
valid=true
Third=Bitwiseand(l,15)
second=Bitwiseand(l\16,15)
first=Bitwiseand(l\256,15)+10*Bitwiseand(l\256\16,15)
end if
End Sub
Function Name() As string
if valid then
if First>=10 then
Return "Mac OS X "+str(First)+"."+str(Second)+"."+str(third)
else
Return "Mac OS "+str(First)+"."+str(Second)+"."+str(third)
end if
end if
End Function
Property First As integer
Property Second As integer
Property Third As integer
Property valid As boolean
End Class
End Project
The items on this page are in the following plugins: MBS MacClassic Plugin.