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