似乎AppMutex
指令不適用於我的安裝腳本。 我遵循這個文章:http://www.jmedved.com/2012/06/mutex-for-innosetup/AppMutex在Inno Setup上不起作用
這是我的應用我的C#代碼:
private static string appGuid = "Loader";
...
bool createdNew;
var mutexSec = new MutexSecurity();
mutexSec.AddAccessRule(
new MutexAccessRule(
new SecurityIdentifier(WellKnownSidType.WorldSid, null),
MutexRights.FullControl, AccessControlType.Allow));
using (var setupMutex = new Mutex(false, @"Global\"+appGuid, out createdNew, mutexSec))
{
if (!createdNew)
{
MessageBox.Show(
"Application already running.", "Loader", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Loader(args));
}
在Inno Setup的腳本,我只是有:
AppMutex=Loader
但是安裝可能,如果還跑應用正在運行。
我也試圖檢查是否真有互斥體,所以用進程管理器我找了應用處理器和我得到這個:
AppMutex=Loader
Mutant \BaseNamedObjects\Loader
我錯過了什麼?
我想說你在'AppMutex'指令val中缺少'Global \'作用域前綴UE。我懷疑沒有這個前綴會在全局命名空間中創建互斥鎖。所以我寧願使用'AppMutex = Global \ Loader'。 – TLama
這就是答案!請回答,以便我可以接受您的解決方案。謝謝 – Tobia