Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Form_Load()
- If App.PrevInstance = True Then
- MsgBox "Already running"
- 'Do whatever you need to do before closing
- End If
- End Sub
- private bool CanIStart
- {
- try
- {
- MyAppMutex= new Mutex(false, "myAppMutex", out createdNew);
- if(MyAppMutex.WaitOne(0,false))
- {
- return true;
- }
- else
- {
- MyAppMutex = null;
- return false;
- }
- }
- catch(ApplicationException ex)
- {
- // we couldn't create the mutex. // log the error if you care
- return false;
- }
- }
- ' Test eventual mark, settings in the registry.
- if GetSetting("MyInstallerApp","Startup","BeenHere",0) = 1 then
- MsgBox "This installer was ran once already... first run the un-installer."
- End ' or some other code to properly exit the installer
- EndIf
- Call SaveSetting ("MyInstallerApp","Startup", "BeenHere", 1) 'leave a mark for future
- ' Allow future Installer to run again
- Call DeleteSetting("MyInstallerApp", "Startup")
Add Comment
Please, Sign In to add comment