From f1c2d0f970b708aa26ab14dc79523b81b65b4b53 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Tue, 5 Oct 2010 06:02:11 +0000 Subject: Improved compatibility with Win9x git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@544 4f64403b-2f21-0410-a795-97e2b3489a10 --- tipper/message_pump.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'tipper/message_pump.cpp') 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); } -- cgit v1.2.3