Changed uiprivHrGetMessageW() to return the BOOL ret value as S_OK and S_FALSE.
This commit is contained in:
parent
05af10aade
commit
559e4bc139
|
@ -115,17 +115,16 @@ int uiInit(void *options, uiInitError *err)
|
|||
void uiMain(void)
|
||||
{
|
||||
MSG msg;
|
||||
BOOL ret;
|
||||
HRESULT hr;
|
||||
|
||||
for (;;) {
|
||||
hr = uiprivHrGetMessageW(&msg, NULL, 0, 0, &ret);
|
||||
hr = uiprivHrGetMessageW(&msg, NULL, 0, 0);
|
||||
if (hr == S_FALSE) // WM_QUIT
|
||||
return;
|
||||
if (hr != S_OK) {
|
||||
// TODO log error
|
||||
return;
|
||||
}
|
||||
if (ret == 0) // WM_QUIT
|
||||
return;
|
||||
// TODO IsDialogMessage()
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageW(&msg);
|
||||
|
|
|
@ -41,13 +41,16 @@ HRESULT WINAPI uiprivHrCreateWindowExW(DWORD exStyle, LPCWSTR className, LPCWSTR
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
// TODO turn ret into S_OK/S_FALSE?
|
||||
HRESULT WINAPI uiprivHrGetMessageW(LPMSG msg, HWND hwnd, UINT filterMin, UINT filterMax, BOOL *ret)
|
||||
HRESULT WINAPI uiprivHrGetMessageW(LPMSG msg, HWND hwnd, UINT filterMin, UINT filterMax)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
SetLastError(0);
|
||||
*ret = GetMessageW(msg, hwnd, filterMin, filterMax);
|
||||
if (*ret < 0)
|
||||
ret = GetMessageW(msg, hwnd, filterMin, filterMax);
|
||||
if (ret < 0)
|
||||
return lastErrorToHRESULT();
|
||||
if (ret == 0)
|
||||
return S_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
extern HRESULT WINAPI uiprivHrRegisterClassW(const WNDCLASSW *wc);
|
||||
extern HRESULT WINAPI uiprivHrCreateWindowExW(DWORD exStyle, LPCWSTR className, LPCWSTR windowName, DWORD style, int x, int y, int width, int height, HWND parent, HMENU menu, HINSTANCE hInstance, LPVOID lpParam, HWND *hwnd);
|
||||
extern HRESULT WINAPI uiprivHrGetMessageW(LPMSG msg, HWND hwnd, UINT filterMin, UINT filterMax, BOOL *ret);
|
||||
// Note: if no error, returns S_FALSE on WM_QUIT, and S_OK otherwise.
|
||||
extern HRESULT WINAPI uiprivHrGetMessageW(LPMSG msg, HWND hwnd, UINT filterMin, UINT filterMax);
|
||||
extern HRESULT WINAPI uiprivHrPostMessageW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
extern HRESULT WINAPI uiprivHrLoadIconW(HINSTANCE hInstance, LPCWSTR name, HICON *hIcon);
|
||||
extern HRESULT WINAPI uiprivHrLoadCursorW(HINSTANCE hInstance, LPCWSTR name, HCURSOR *hCursor);
|
||||
|
|
Loading…
Reference in New Issue