diff options
-rw-r--r-- | embedserv/source/embed/tracker.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/appl/shutdowniconw32.cxx | 9 | ||||
-rw-r--r-- | vcl/win/dtrans/MtaOleClipb.cxx | 23 | ||||
-rw-r--r-- | vcl/win/dtrans/target.cxx | 10 |
4 files changed, 44 insertions, 10 deletions
diff --git a/embedserv/source/embed/tracker.cxx b/embedserv/source/embed/tracker.cxx index 00260481c0a8..dbe114660f61 100644 --- a/embedserv/source/embed/tracker.cxx +++ b/embedserv/source/embed/tracker.cxx @@ -22,11 +22,18 @@ #include <algorithm> #include <sal/types.h> +#include <sal/log.hxx> #include <stdafx.h> #include <stddef.h> #include <syswinwrapper.hxx> +// windowserrorstring.hxx includes postwin.h, which #undef OPAQUE, so "#redef" it +#include <comphelper/windowserrorstring.hxx> +#ifdef OPAQUE +#error OPAQUE should not be defined!? +#endif +#define OPAQUE 2 static HCURSOR afxCursors[10] = { nullptr, }; static HBRUSH afxHalftoneBrush = nullptr; @@ -398,7 +405,10 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo) for (;;) { MSG msg; - GetMessageW(&msg, nullptr, 0, 0); + BOOL bRet = GetMessageW(&msg, nullptr, 0, 0); + SAL_WARN_IF(-1 == bRet, "embedserv", "GetMessageW failed: " << WindowsErrorString(GetLastError())); + if (-1 == bRet || 0 == bRet) + break; if (GetCapture() != hWnd) break; diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 0f1aa36301d7..298d84bf7d89 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -33,6 +33,7 @@ #include <osl/thread.h> #include <systools/win32/qswin32.h> #include <comphelper/sequenceashashmap.hxx> +#include <comphelper/windowserrorstring.hxx> #include <o3tl/char16_t2wchar_t.hxx> #include <set> @@ -458,9 +459,15 @@ static DWORD WINAPI SystrayThread( LPVOID /*lpParam*/ ) ); MSG msg; + BOOL bRet; - while ( GetMessageW( &msg, nullptr, 0, 0 ) ) + while ((bRet = GetMessageW(&msg, nullptr, 0, 0)) != 0) { + if (-1 == bRet) + { + SAL_WARN("sfx.appl", "GetMessageW failed: " << WindowsErrorString(GetLastError())); + return 1; + } TranslateMessage( &msg ); DispatchMessageW( &msg ); } diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx index 6fc789e27d9d..f6e471925516 100644 --- a/vcl/win/dtrans/MtaOleClipb.cxx +++ b/vcl/win/dtrans/MtaOleClipb.cxx @@ -45,6 +45,8 @@ #include <systools/win32/comtools.hxx> +#include <comphelper/windowserrorstring.hxx> + // namespace directives using osl::MutexGuard; @@ -642,22 +644,29 @@ unsigned int CMtaOleClipboard::run( ) createMtaOleReqWnd( ); - unsigned int nRet; + unsigned int nRet = ~0U; // = error if ( IsWindow( m_hwndMtaOleReqWnd ) ) { if ( nullptr != m_hEvtThrdReady ) SetEvent( m_hEvtThrdReady ); + nRet = 0; + // pumping messages MSG msg; - while( GetMessageW( &msg, nullptr, 0, 0 ) ) - DispatchMessageW( &msg ); - - nRet = 0; + BOOL bRet; + while ((bRet = GetMessageW(&msg, nullptr, 0, 0)) != 0) + { + if (-1 == bRet) + { + SAL_WARN("vcl.win.dtrans", "GetMessageW failed: " << WindowsErrorString(GetLastError())); + nRet = ~0U; + break; + } + DispatchMessageW(&msg); + } } - else - nRet = ~0U; OleUninitialize( ); diff --git a/vcl/win/dtrans/target.cxx b/vcl/win/dtrans/target.cxx index adddabab7038..45a8515bd414 100644 --- a/vcl/win/dtrans/target.cxx +++ b/vcl/win/dtrans/target.cxx @@ -30,6 +30,8 @@ #include "targetdragcontext.hxx" #include <rtl/ustring.h> #include <osl/thread.h> +#include <sal/log.hxx> +#include <comphelper/windowserrorstring.hxx> #include "DOTransferable.hxx" @@ -206,8 +208,14 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams) DWORD threadId= GetCurrentThreadId(); // We force the creation of a thread message queue. This is necessary // for a later call to AttachThreadInput - while( GetMessageW(&msg, nullptr, 0, 0) ) + BOOL bRet; + while ((bRet = GetMessageW(&msg, nullptr, 0, 0)) != 0) { + if (-1 == bRet) + { + SAL_WARN("vcl.win.dtrans", "GetMessageW failed: " << WindowsErrorString(GetLastError())); + break; + } if( msg.message == WM_REGISTERDRAGDROP) { DropTarget *pTarget= reinterpret_cast<DropTarget*>(msg.wParam); |