#include "wx/dynlib.h"
#include "wx/evtloop.h"
#include "wx/thread.h"
+#include "wx/scopeguard.h"
#include "wx/msw/private.h"
#include "wx/msw/dc.h"
typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
#endif // defined(DLLVERSIONINFO)
+#ifndef ATTACH_PARENT_PROCESS
+ #define ATTACH_PARENT_PROCESS ((DWORD)-1)
+#endif
// ---------------------------------------------------------------------------
// global variables
if ( len )
{
buf.extend(len);
- const int len2 = m_pfnGetConsoleCommandHistory(buf.data(), len, CMD_EXE);
- wxASSERT_MSG( len2 == len, _T("failed getting history?") );
+
+ int len2 = m_pfnGetConsoleCommandHistory(buf.data(), len, CMD_EXE);
+
+#if !wxUSE_UNICODE
+ // there seems to be a bug in the GetConsoleCommandHistoryA(), it
+ // returns the length of Unicode string and not ANSI one
+ len2 /= 2;
+#endif // !wxUSE_UNICODE
+
+ if ( len2 != len )
+ {
+ wxFAIL_MSG( _T("failed getting history?") );
+ }
}
return len;
// MT-FIXME
static bool s_inYield = false;
-#if wxUSE_LOG
- // disable log flushing from here because a call to wxYield() shouldn't
- // normally result in message boxes popping up &c
- wxLog::Suspend();
-#endif // wxUSE_LOG
-
if ( s_inYield )
{
if ( !onlyIfNeeded )
return false;
}
+ // set the flag and don't forget to reset it before returning
s_inYield = true;
+ wxON_BLOCK_EXIT_SET(s_inYield, false);
+
+
+#if wxUSE_LOG
+ // disable log flushing from here because a call to wxYield() shouldn't
+ // normally result in message boxes popping up &c
+ wxLog::Suspend();
+
+ // ensure the logs will be flashed again when we exit
+ wxON_BLOCK_EXIT0(wxLog::Resume);
+#endif // wxUSE_LOG
+
// we don't want to process WM_QUIT from here - it should be processed in
// the main event loop in order to stop it
// if there are pending events, we must process them.
ProcessPendingEvents();
-#if wxUSE_LOG
- // let the logs be flashed again
- wxLog::Resume();
-#endif // wxUSE_LOG
-
- s_inYield = false;
-
return true;
}