Singles Only!

BlitzMax Modules Forums/Brucey's Modules/Singles Only!

Ever wanted to check if your app was already running? Now you can, with wxSingleInstanceChecker.

You create the object either as a global or perhaps as a field of your wxApp object - so that it stays alive for the duration of your program.

Then, given a unique name, simply check on startup :

Method OnInit:Int()
    Local name:String = "MyApp-" + wxGetUserId() 
    
    m_checker = new wxSingleInstanceChecker.Create(name)
    
    If m_checker.IsAnotherRunning() Then 
        wxLogError(_("Another program instance is already running, aborting.")) 
        Return False
    End If
    ... more initializations ... 
    Return True
End Method




Another wxMax tip for your viewing pleasure..

:o)