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
// 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");

View File

@ -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));
}

View File

@ -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);
}
}

View File

@ -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