Event to detect secondary ZRCola launch implemented by winstd::win_handle now
This commit is contained in:
parent
ba8254c097
commit
ecefcecfd8
@ -115,6 +115,9 @@
|
|||||||
<ProjectReference Include="..\lib\libZRCola\build\libZRCola.vcxproj">
|
<ProjectReference Include="..\lib\libZRCola\build\libZRCola.vcxproj">
|
||||||
<Project>{3c61929e-7289-4101-8d0a-da22d6e1aea8}</Project>
|
<Project>{3c61929e-7289-4101-8d0a-da22d6e1aea8}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\lib\wxExtend\build\wxExtendDll.vcxproj">
|
<ProjectReference Include="..\lib\wxExtend\build\wxExtendDll.vcxproj">
|
||||||
<Project>{a3a36689-ac35-4026-93da-a3ba0c0e767c}</Project>
|
<Project>{a3a36689-ac35-4026-93da-a3ba0c0e767c}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
@ -32,9 +32,6 @@ wxIMPLEMENT_APP(ZRColaApp);
|
|||||||
|
|
||||||
ZRColaApp::ZRColaApp() :
|
ZRColaApp::ZRColaApp() :
|
||||||
m_mainWnd(NULL),
|
m_mainWnd(NULL),
|
||||||
#ifdef __WXMSW__
|
|
||||||
m_running(NULL),
|
|
||||||
#endif
|
|
||||||
wxApp()
|
wxApp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -68,8 +65,7 @@ bool ZRColaApp::OnInit()
|
|||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// Create global event.
|
// Create global event.
|
||||||
m_running = ::CreateEvent(NULL, FALSE, FALSE, _T(ZRCOLA_CFG_APPLICATION) _T("{BBDE7AAD-29B6-4B83-ADA1-92AFA81A0883}"));
|
m_running.attach(::CreateEvent(NULL, FALSE, FALSE, _T(ZRCOLA_CFG_APPLICATION) _T("{BBDE7AAD-29B6-4B83-ADA1-92AFA81A0883}")));
|
||||||
wxASSERT(m_running);
|
|
||||||
if (::GetLastError() == ERROR_ALREADY_EXISTS) {
|
if (::GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||||
// ZRCola is already running. Find its window.
|
// ZRCola is already running. Find its window.
|
||||||
HWND okno = ::FindWindow(_T("wxWindowNR"), _("ZRCola"));
|
HWND okno = ::FindWindow(_T("wxWindowNR"), _("ZRCola"));
|
||||||
@ -176,10 +172,7 @@ int ZRColaApp::OnExit()
|
|||||||
int res = wxApp::OnExit();
|
int res = wxApp::OnExit();
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
if (m_running) {
|
m_running.free();
|
||||||
wxVERIFY(::CloseHandle(m_running));
|
|
||||||
m_running = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -26,6 +26,7 @@ class ZRColaApp;
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "zrcolafrm.h"
|
#include "zrcolafrm.h"
|
||||||
|
#include <WinStd/Win.h>
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/config.h>
|
#include <wx/config.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
@ -83,7 +84,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
HANDLE m_running; ///< Global Win32 event to determine if another instance of ZRCola is already running
|
winstd::win_handle m_running; ///< Global Win32 event to determine if another instance of ZRCola is already running
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user