You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/WindowsMutexTest
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
EventHandler Sub Open()
w=new WindowsMutexMBS
w.Create "de.monkeybreadsoftware.realbasic.plugin.test"
if w.Lasterror=0 then
Title="first app. "+hex(w.Handle)
else
Title="allready running. "+str(w.Lasterror)
end if
StaticText3.text=Format(w.Handle,"-0")
StaticText4.text=Format(w.Lasterror,"-0")
End EventHandler
Property Protected w As WindowsMutexMBS
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
End Class