diff options
Diffstat (limited to 'redo/common_windows.c')
| -rw-r--r-- | redo/common_windows.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/redo/common_windows.c b/redo/common_windows.c new file mode 100644 index 0000000..6b9bf8c --- /dev/null +++ b/redo/common_windows.c @@ -0,0 +1,36 @@ +// 17 july 2014 + +#include "winapi_windows.h" + +LRESULT getWindowTextLen(HWND hwnd) +{ + return SendMessageW(hwnd, WM_GETTEXTLENGTH, 0, 0); +} + +void getWindowText(HWND hwnd, WPARAM n, LPCWSTR out) +{ + SetLastError(0); + if (SendMessageW(hwnd, WM_GETTEXT, n + 1, (LPARAM) buf) != n) + xpanic("WM_GETTEXT did not copy the correct number of characters out", GetLastError()); +} + +void setWindowText(HWND hwnd, LPCWSTR text) +{ + switch (SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM) text)) { + case FALSE: + xpanic("WM_SETTEXT failed", GetLastError()); + } +} + +void updateWindow(HWND hwnd) +{ + if (UpdateWindow(hwnd) == 0) + xpanic("error calling UpdateWindow()", GetLastError()); +} + +void storelpParam(HWND hwnd, LPARAM lParam) +{ + CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam; + + SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) (cs->lpCreateParams)); +} |
