X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..ab9893576c877f5691023315c23c8348d9d6affd:/src/msw/snglinst.cpp?ds=sidebyside diff --git a/src/msw/snglinst.cpp b/src/msw/snglinst.cpp index b3f621b44d..3771a77809 100644 --- a/src/msw/snglinst.cpp +++ b/src/msw/snglinst.cpp @@ -7,7 +7,7 @@ // Created: 08.06.01 // RCS-ID: $Id$ // Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -18,10 +18,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "snglinst.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -44,7 +40,7 @@ // wxSingleInstanceCheckerImpl: the real implementation class // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxSingleInstanceCheckerImpl +class WXDLLIMPEXP_BASE wxSingleInstanceCheckerImpl { public: wxSingleInstanceCheckerImpl() @@ -56,24 +52,24 @@ public: bool Create(const wxString& name) { - m_hMutex = ::CreateMutex(NULL, FALSE, name); + m_hMutex = ::CreateMutex(NULL, FALSE, name.t_str()); if ( !m_hMutex ) { - wxLogLastError(_T("CreateMutex")); + wxLogLastError(wxT("CreateMutex")); - return FALSE; + return false; } // mutex was either created or opened - see what really happened m_wasOpened = ::GetLastError() == ERROR_ALREADY_EXISTS; - return TRUE; + return true; } bool WasOpened() const { - wxCHECK_MSG( m_hMutex, FALSE, - _T("can't be called if mutex creation failed") ); + wxCHECK_MSG( m_hMutex, false, + wxT("can't be called if mutex creation failed") ); return m_wasOpened; } @@ -84,7 +80,7 @@ public: { if ( !::CloseHandle(m_hMutex) ) { - wxLogLastError(_T("CloseHandle(mutex)")); + wxLogLastError(wxT("CloseHandle(mutex)")); } } } @@ -96,7 +92,7 @@ private: // the mutex handle, may be NULL HANDLE m_hMutex; - DECLARE_NO_COPY_CLASS(wxSingleInstanceCheckerImpl) + wxDECLARE_NO_COPY_CLASS(wxSingleInstanceCheckerImpl); }; // ============================================================================ @@ -107,19 +103,19 @@ bool wxSingleInstanceChecker::Create(const wxString& name, const wxString& WXUNUSED(path)) { wxASSERT_MSG( !m_impl, - _T("calling wxSingleInstanceChecker::Create() twice?") ); + wxT("calling wxSingleInstanceChecker::Create() twice?") ); // creating unnamed mutex doesn't have the same semantics! - wxASSERT_MSG( !name.empty(), _T("mutex name can't be empty") ); + wxASSERT_MSG( !name.empty(), wxT("mutex name can't be empty") ); m_impl = new wxSingleInstanceCheckerImpl; return m_impl->Create(name); } -bool wxSingleInstanceChecker::IsAnotherRunning() const +bool wxSingleInstanceChecker::DoIsAnotherRunning() const { - wxCHECK_MSG( m_impl, FALSE, _T("must call Create() first") ); + wxCHECK_MSG( m_impl, false, wxT("must call Create() first") ); // if the mutex had been opened, another instance is running - otherwise we // would have created it