diff options
Diffstat (limited to 'tipper/message_pump.cpp')
-rw-r--r-- | tipper/message_pump.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/tipper/message_pump.cpp b/tipper/message_pump.cpp index be7fa92..88b0858 100644 --- a/tipper/message_pump.cpp +++ b/tipper/message_pump.cpp @@ -4,11 +4,12 @@ #include "options.h"
#include "str_utils.h"
-HMODULE hUserDll;
-BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD) = 0;
-BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags) = 0;
+BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
+BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags);
+HMONITOR (WINAPI *MyMonitorFromPoint)(POINT, DWORD);
+BOOL (WINAPI *MyGetMonitorInfo)(HMONITOR, LPMONITORINFO);
-unsigned int message_pump_thread_id = 0;
+unsigned int message_pump_thread_id;
unsigned int CALLBACK MessagePumpThread(void *param)
{
@@ -70,27 +71,32 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) { void InitMessagePump() {
WNDCLASS popup_win_class = {0};
- popup_win_class.style = 0;
popup_win_class.lpfnWndProc = PopupWindowProc;
popup_win_class.hInstance = hInst;
popup_win_class.lpszClassName = POP_WIN_CLASS;
popup_win_class.hCursor = LoadCursor(NULL, IDC_ARROW);
RegisterClass(&popup_win_class);
- hUserDll = LoadLibrary(_T("user32.dll"));
+ HMODULE hUserDll = GetModuleHandle(_T("user32.dll"));
if (hUserDll) {
MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes");
MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow");
+ MyMonitorFromPoint = (HMONITOR (WINAPI*)(POINT, DWORD))GetProcAddress(hUserDll, "MonitorFromPoint");
+#ifdef _UNICODE
+ MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR, LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoW");
+#else
+ MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR, LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoA");
+#endif
}
+
+
CloseHandle(mir_forkthreadex(MessagePumpThread, NULL, 0, &message_pump_thread_id));
}
void DeinitMessagePump() {
PostMPMessage(WM_QUIT, 0, 0);
- FreeLibrary(hUserDll);
-
UnregisterClass(POP_WIN_CLASS, hInst);
}
|