diff options
author | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-10-05 06:02:11 +0000 |
---|---|---|
committer | (no author) <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> | 2010-10-05 06:02:11 +0000 |
commit | f1c2d0f970b708aa26ab14dc79523b81b65b4b53 (patch) | |
tree | 87d81e8f805e2f45f2b758b9768e95b61e0ed888 | |
parent | cda4bce6aea57e3c131e281551ad0b3f9f907932 (diff) |
Improved compatibility with Win9x
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@544 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | tipper/message_pump.cpp | 22 | ||||
-rw-r--r-- | tipper/message_pump.h | 3 | ||||
-rw-r--r-- | tipper/popwin.cpp | 20 | ||||
-rw-r--r-- | tipper/tipper_9.vcproj | 1 |
4 files changed, 26 insertions, 20 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);
}
diff --git a/tipper/message_pump.h b/tipper/message_pump.h index fe59dad..4f7acfb 100644 --- a/tipper/message_pump.h +++ b/tipper/message_pump.h @@ -9,9 +9,10 @@ void PostMPMessage(UINT msg, WPARAM, LPARAM); #define MUM_GOTAVATAR (WM_USER + 0x014)
#define MUM_REDRAW (WM_USER + 0x015)
-extern HMODULE hUserDll;
extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
extern BOOL (WINAPI *MyAnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags);
+extern HMONITOR (WINAPI *MyMonitorFromPoint)(POINT, DWORD);
+extern BOOL (WINAPI *MyGetMonitorInfo)(HMONITOR, LPMONITORINFO);
void InitMessagePump();
void DeinitMessagePump();
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp index 6e8ac5c..d0cbf4f 100644 --- a/tipper/popwin.cpp +++ b/tipper/popwin.cpp @@ -877,25 +877,25 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowRgn(hwnd,hRgn1,FALSE);
}
return TRUE;
+
case PUM_CALCPOS:
{
RECT wa_rect, r;
- HMONITOR hMonitor;
- hMonitor = MonitorFromPoint(pwd->clcit.ptCursor, MONITOR_DEFAULTTONEAREST);
-
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- GetMonitorInfo(hMonitor, &mi);
-
- wa_rect = mi.rcWork;
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &wa_rect, FALSE);
+ if (MyMonitorFromPoint)
+ {
+ HMONITOR hMon = MyMonitorFromPoint(pwd->clcit.ptCursor, MONITOR_DEFAULTTONEAREST);
+ MONITORINFO mi;
+ mi.cbSize = sizeof(mi);
+ if (MyGetMonitorInfo(hMon, &mi))
+ wa_rect = mi.rcWork;
+ }
GetWindowRect(hwnd, &r);
CURSORINFO ci = {sizeof(CURSORINFO)};
GetCursorInfo(&ci);
-
-
int x = 0, y = 0, width = (r.right - r.left), height = (r.bottom - r.top);
diff --git a/tipper/tipper_9.vcproj b/tipper/tipper_9.vcproj index f5f24c0..d20201d 100644 --- a/tipper/tipper_9.vcproj +++ b/tipper/tipper_9.vcproj @@ -662,7 +662,6 @@ AdditionalDependencies="comctl32.lib"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
- GenerateMapFile="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
|