You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Register Windows FileType
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control Extension Inherits TextField
ControlInstance Extension Inherits TextField
EventHandler Sub TextChange()
r.extension=me.text
End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control Description Inherits TextField
ControlInstance Description Inherits TextField
EventHandler Sub TextChange()
r.description=me.text
End EventHandler
End Control
Control OpenDescription Inherits TextField
ControlInstance OpenDescription Inherits TextField
EventHandler Sub TextChange()
r.OpenDescription=me.text
End EventHandler
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control GroupBox1 Inherits GroupBox
ControlInstance GroupBox1 Inherits GroupBox
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control iconfile Inherits Label
ControlInstance iconfile Inherits Label
End Control
Control ChooseIcobFile Inherits PushButton
ControlInstance ChooseIcobFile Inherits PushButton
EventHandler Sub Action()
dim f as folderItem
f=getopenFolderItem("special/any")
if f<>nil then
r.iconfile=f
iconfile.text=f.NativePath
end if
End EventHandler
End Control
Control StaticText8 Inherits Label
ControlInstance StaticText8 Inherits Label
End Control
Control IconId Inherits TextField
ControlInstance IconId Inherits TextField
EventHandler Sub TextChange()
r.iconID=val(me.text)
End EventHandler
End Control
Control GroupBox2 Inherits GroupBox
ControlInstance GroupBox2 Inherits GroupBox
End Control
Control StaticText6 Inherits Label
ControlInstance StaticText6 Inherits Label
End Control
Control appfile Inherits Label
ControlInstance appfile Inherits Label
End Control
Control ChooseAppFile Inherits PushButton
ControlInstance ChooseAppFile Inherits PushButton
EventHandler Sub Action()
dim f as folderItem
f=getopenFolderItem("special/any")
if f<>nil then
r.appFile=f
appfile.text=f.NativePath
end if
End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
dim n as integer
dim s as string
n=r.Create
select case n
case -1
s="Called from Mac OS."
case 0
s="OK"
case 1
s="Failed to create main extension key."
case 2
s="Failed to create the description key for file type."
case 3
s="Failed to create the key for the icon."
case 4
s="Failed to create the key for the open description."
case 5
s="Required parameters not provided."
else
s="Unknown Error. (Please report the number)"
end select
msgBox str(n)+": "+s
End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim n as integer
n=r.Remove
msgBox "Error code: "+str(n)
End EventHandler
End Control
EventHandler Sub Open()
r=new RegistryFileTypeMBS
r.Extension=".MBS"
r.OpenDescription="Open MBS File"
r.description="Monkeybread File"
r.appFile=app.ApplicationFileMBS
r.iconfile=app.ApplicationFileMBS // so the files get an RB icon
r.iconid=0
r.FileType="MBSFile"
appfile.text=r.appFile.NativePath
iconfile.text=r.iconfile.NativePath
End EventHandler
Property r As RegistryFileTypeMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub OpenDocument(item As FolderItem)
// Absolutepath gives short name, but I prefer long path.
msgBox "You opened "+item.LongPathMBS+" using this application (made with REALbasic)."
quit
End EventHandler
End Class