More fixes. Halfway through the alphabet now.

This commit is contained in:
Pietro Gagliardi 2016-04-23 22:29:54 -04:00
parent 158db39b68
commit c53e1c0b7d
4 changed files with 11 additions and 11 deletions

View File

@ -11,12 +11,12 @@ HBRUSH hollowBrush;
// the returned pointer is actually to the second character // the returned pointer is actually to the second character
// if the first character is - then free, otherwise don't // 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; WCHAR *sysmsg;
BOOL hassysmsg; BOOL hassysmsg;
WCHAR *wmessage; WCHAR *wmessage;
WCHAR *out; WCHAR *wout;
char *out; char *out;
hassysmsg = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, value, 0, (LPWSTR) (&sysmsg), 0, NULL) != 0; 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; return out + 1;
} }
#define ieLastErr(msg) initerr("=" message, L"GetLastError() ==", GetLastError()) #define ieLastErr(msg) initerr("=" msg, L"GetLastError() ==", GetLastError())
#define ieHRESULT(msg, hr) initerr("=" message, L"HRESULT", (DWORD) hr) #define ieHRESULT(msg, hr) initerr("=" msg, L"HRESULT", (DWORD) hr)
// TODO make common // TODO make common
uiInitOptions options; uiInitOptions options;
@ -81,7 +81,7 @@ const char *uiInit(uiInitOptions *o)
ce = initUtilWindow(hDefaultIcon, hDefaultCursor); ce = initUtilWindow(hDefaultIcon, hDefaultCursor);
if (ce != NULL) if (ce != NULL)
return ieLastErr(ce); return ieLastErr("TODO use ce here");
if (registerWindowClass(hDefaultIcon, hDefaultCursor) == 0) if (registerWindowClass(hDefaultIcon, hDefaultCursor) == 0)
return ieLastErr("registering uiWindow window class"); return ieLastErr("registering uiWindow window class");

View File

@ -29,7 +29,7 @@ char *uiLabelText(uiLabel *l)
void uiLabelSetText(uiLabel *l, const char *text) 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 // changing the text might necessitate a change in the label's size
uiWindowsControlQueueRelayout(uiWindowsControl(l)); uiWindowsControlQueueRelayout(uiWindowsControl(l));
} }

View File

@ -23,7 +23,7 @@ discard:
return 1; return 1;
callNext: callNext:
return CallNextHookEx(areaFilter, code, wParam, lParam); return CallNextHookEx(filter, code, wParam, lParam);
} }
int registerMessageFilter(void) int registerMessageFilter(void)
@ -37,7 +37,7 @@ int registerMessageFilter(void)
void unregisterMessageFilter(void) void unregisterMessageFilter(void)
{ {
if (UnhookWindowsHookEx(areaFilter) == 0) if (UnhookWindowsHookEx(filter) == 0)
logLastError(L"error unregistering libui message filter"); 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 // TODO find documentation that says IsDialogMessage() calls CallMsgFilter() for us, because that's what's happening
if (IsDialogMessage(active, &msg) != 0) if (IsDialogMessage(active, &msg) != 0)
continue; continue;
TranslateMessage(msg); TranslateMessage(&msg);
DispatchMessageW(msg); DispatchMessageW(&msg);
} }
} }

View File

@ -86,7 +86,7 @@ extern const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor);
extern void uninitUtilWindow(void); extern void uninitUtilWindow(void);
// main.cpp // main.cpp
extern void registerMessageFilter(void); extern int registerMessageFilter(void);
extern void unregisterMessageFilter(void); extern void unregisterMessageFilter(void);
// parent.cpp // parent.cpp