Add AppMutex to setup

Any ideas about how to improve MediaMonkey for Windows 4? Let us know!

Moderator: Gurus

Another_MM_User

Add AppMutex to setup

Post by Another_MM_User »

I see that MediaMonkey.exe has an application mutant (mutex). It would be useful to use it in the InnoSetup script to prevent installing/uninstalling when MediaMonkey is running.
...

Code: Select all

[Setup]
...
AppMutex=MediaMonkey
Also it might be useful to use a setup mutex to prevent two instances of the setup.

Code: Select all

[Code]
// Create a constant for the installer
const installer_mutex_name = 'mediamonkey_setup_mutex';

...

function InitializeSetup(): Boolean;
begin
	// Create a mutex for the installer and if it's already running then expose a message and stop installation
	Result := True;
	if CheckForMutexes(installer_mutex_name) then begin
		if not WizardSilent() then
			MsgBox(ExpandConstant('{cm:SetupIsRunningWarningInstall,MediaMonkey}'), mbError, MB_OK);
			Result := False;
		end
		else begin
		CreateMutex(installer_mutex_name);
	end;
end;

...

function InitializeUninstall(): Boolean;
begin
	Result := True;
	if CheckForMutexes(installer_mutex_name) then begin
		if not WizardSilent() then
			MsgBox(ExpandConstant('{cm:SetupIsRunningWarningUninstall,MediaMonkey}'), mbError, MB_OK);
		Result := False;
		end
		else begin
		CreateMutex(installer_mutex_name);
	end;
end;

[CustomMessages]
en.SetupIsRunningWarningInstall=%1`s setup is already running!
en.SetupIsRunningWarningUninstall=%1`s setup is already running!
The above is just an example which works, but you can customize it to fit your needs. :wink:
Another_MM_User

Re: Add AppMutex to setup

Post by Another_MM_User »

I don't think this belongs to the Wishlist, because IMO every descent installer should do a check for the things I mentioned before. It might not be critical, but it's a must.
But anyway, it's your choice at last.:)
nohitter151
Posts: 23640
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA
Contact:

Re: Add AppMutex to setup

Post by nohitter151 »

MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?

Please no PMs in reply to a post. Just reply in the thread.
jiri
Posts: 5433
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Add AppMutex to setup

Post by jiri »

This will be added in the next build. (Only the check for MM running, not the check for two setup instances.)

Thanks,
Jiri
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Add AppMutex to setup

Post by nynaevelan »

This is a major PITA and inconvenience when you have more than one installation of MM and you are trying to install to another instance. Can this be configurable to give the user the option to continue installation??

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
Post Reply