Extended the running instance MessageBox with the paths of the instances. Made to get a better fix for #3526579

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1847 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-05-14 15:44:08 +00:00
commit e5cf074386
5 changed files with 72 additions and 52 deletions

View file

@ -215,7 +215,23 @@ namespace Greenshot {
if (filesToOpen.Count > 0) {
SendData(transport);
} else {
MessageBox.Show(Language.GetString(LangKey.error_multipleinstances), Language.GetString(LangKey.error));
StringBuilder instanceInfo = new StringBuilder();
bool matchedThisProcess = false;
int index = 1;
foreach (Process greenshotProcess in Process.GetProcessesByName("greenshot")) {
try {
instanceInfo.Append(index++ + ": ").AppendLine(Kernel32.GetProcessPath(new IntPtr(greenshotProcess.Id)));
if (Process.GetCurrentProcess().Id == greenshotProcess.Id) {
matchedThisProcess = true;
}
} catch (Exception ex) {
LOG.Debug(ex);
}
}
if (!matchedThisProcess) {
instanceInfo.Append(index++ + ": ").AppendLine(Kernel32.GetProcessPath(new IntPtr(Process.GetCurrentProcess().Id)));
}
MessageBox.Show(Language.GetString(LangKey.error_multipleinstances) + "\r\n" + instanceInfo.ToString(), Language.GetString(LangKey.error));
}
FreeMutex();
Application.Exit();