diff --git a/windows/init.cpp b/windows/init.cpp index b5ba4e9b..bb0b6794 100644 --- a/windows/init.cpp +++ b/windows/init.cpp @@ -11,12 +11,12 @@ HBRUSH hollowBrush; // the returned pointer is actually to the second character // if the first character is - then free, otherwise don't -static const char *initerr(const char *message, const WCHAR *label, DWORD code) +static const char *initerr(const char *message, const WCHAR *label, DWORD value) { WCHAR *sysmsg; BOOL hassysmsg; WCHAR *wmessage; - WCHAR *out; + WCHAR *wout; char *out; hassysmsg = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, value, 0, (LPWSTR) (&sysmsg), 0, NULL) != 0; @@ -37,8 +37,8 @@ static const char *initerr(const char *message, const WCHAR *label, DWORD code) return out + 1; } -#define ieLastErr(msg) initerr("=" message, L"GetLastError() ==", GetLastError()) -#define ieHRESULT(msg, hr) initerr("=" message, L"HRESULT", (DWORD) hr) +#define ieLastErr(msg) initerr("=" msg, L"GetLastError() ==", GetLastError()) +#define ieHRESULT(msg, hr) initerr("=" msg, L"HRESULT", (DWORD) hr) // TODO make common uiInitOptions options; @@ -81,7 +81,7 @@ const char *uiInit(uiInitOptions *o) ce = initUtilWindow(hDefaultIcon, hDefaultCursor); if (ce != NULL) - return ieLastErr(ce); + return ieLastErr("TODO use ce here"); if (registerWindowClass(hDefaultIcon, hDefaultCursor) == 0) return ieLastErr("registering uiWindow window class"); diff --git a/windows/label.cpp b/windows/label.cpp index 0a02827a..6d3a4cd5 100644 --- a/windows/label.cpp +++ b/windows/label.cpp @@ -29,7 +29,7 @@ char *uiLabelText(uiLabel *l) void uiLabelSetText(uiLabel *l, const char *text) { - uiWindowsWindowSetText(l->hwnd, text); + uiWindowsSetWindowText(l->hwnd, text); // changing the text might necessitate a change in the label's size uiWindowsControlQueueRelayout(uiWindowsControl(l)); } diff --git a/windows/main.cpp b/windows/main.cpp index 5177a6d1..2480cd46 100644 --- a/windows/main.cpp +++ b/windows/main.cpp @@ -23,7 +23,7 @@ discard: return 1; callNext: - return CallNextHookEx(areaFilter, code, wParam, lParam); + return CallNextHookEx(filter, code, wParam, lParam); } int registerMessageFilter(void) @@ -37,7 +37,7 @@ int registerMessageFilter(void) void unregisterMessageFilter(void) { - if (UnhookWindowsHookEx(areaFilter) == 0) + if (UnhookWindowsHookEx(filter) == 0) logLastError(L"error unregistering libui message filter"); } @@ -63,8 +63,8 @@ void uiMain(void) // TODO find documentation that says IsDialogMessage() calls CallMsgFilter() for us, because that's what's happening if (IsDialogMessage(active, &msg) != 0) continue; - TranslateMessage(msg); - DispatchMessageW(msg); + TranslateMessage(&msg); + DispatchMessageW(&msg); } } diff --git a/windows/uipriv_windows.hpp b/windows/uipriv_windows.hpp index eb8879ad..48b772c9 100644 --- a/windows/uipriv_windows.hpp +++ b/windows/uipriv_windows.hpp @@ -86,7 +86,7 @@ extern const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor); extern void uninitUtilWindow(void); // main.cpp -extern void registerMessageFilter(void); +extern int registerMessageFilter(void); extern void unregisterMessageFilter(void); // parent.cpp