Hmm... issue still persists on [
27.90.0010 (64-bit)]. My OS: [
Windows 10: Version 10.0.19045.6093].
Perhaps the following in main before anything else could help solve the issue.
Code: Select all
static HANDLE appmut = NULL;
int WINAPI wWinMain(_In_ HINSTANCE hinstance, _In_opt_ HINSTANCE prevhinstance, _In_ LPWSTR wargv, _In_ int cmdshow)
{
appmut = CreateMutexW(NULL, TRUE, L"MyApplication");
if(!appmut)
{
MessageBoxW(NULL, L"Was unable to initialize with mutex...", L"MyApplication", MB_OK);
ExitProcess(0);
}
else if(GetLastError() == ERROR_ALREADY_EXISTS)
{
HWND myappinstance = FindWindowW(appName, appName);
if(myappinstance)
{
SetForegroundWindow(myappinstance);
}
return FALSE;
}
// ...
}
And program arguments can be intercepted and passed to tab creation thread. And a `ReleaseMutex(appmut)` on `WM_CLOSE` of main XYPlorer window WndProc.
I think currently the single instance enforcement is just a window existence check of the harcoded name containing "XYplorer" and not a true mutex. So if the name of the binary changes, the enforcement becomes void. Obviously I am not changing the name of the exe all the time, I was just actively testing for issues as I recently started frequently using XYplorer again. It's a joy to use!
The dual tab creation also seems to persist, but something I have noticed is that it will only do that if the shortcut has VK_SHIFT combined with VK_MENU, which I am passing from AutoHotkey v2. Cannot understand why it happens. I think it might be because I configured AutoHotkey to actually create a new true process instead of just using the Run command (using the ahk author provided 'shell run' script), but I'm not sure.
Of course, the application is much more complex than this and I am unable to consider nor comprehend all other factors in the functioning - I'm just throwing out some ideas which I hope could aid in improving stability...
Thank you kindly,