Platforms to show: All Mac Windows Linux Cross-Platform

/Win/App Instances


Required plugins for this example: MBS Win Plugin, MBS ComputerControl Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/App Instances

This example is the version from Tue, 15th Sep 2014.

Project "App Instances.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Close() If myMutex <> Nil Then // cleanup myMutex.Leave End If End EventHandler
EventHandler Sub Open() 'RegisterPlugins // somewhere at app launch // Please change name of mutex and name of notification! myMutex = New Mutex("MyGreatApp") myNotification = new myWinNotificationMBS If myMutex.TryEnter Then Window1.Listbox1.AddRow "First instance." // listen for notification call myNotification.ListenForMessage "MyGreatAppNotification" else Window1.Listbox1.AddRow "Second instance." // send notification to first instance call myNotification.SendMessage "MyGreatAppNotification" quit End If End EventHandler
Property myMutex As Mutex
Property myNotification As myWinNotificationMBS
End Class
Class Window1 Inherits Window
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&Datei"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class myWinNotificationMBS Inherits WinNotificationMBS
EventHandler Sub GotNotification(Message as Integer, Name as string, Value1 as Integer, Value2 as Integer) window1.Listbox1.AddRow "got notification" // try things twice window1.show call RemoteControlMBS.WinBringWindowToTop window1.Handle window1.show call RemoteControlMBS.WinBringWindowToTop window1.Handle End EventHandler
End Class
End Project

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...