From a912097411a247b945841c172cb2fe7a6b748518 Mon Sep 17 00:00:00 2001 From: sje Date: Tue, 30 Jan 2007 22:46:16 +0000 Subject: fix for dynamic load of GetMonitorInfo for ansi/unicode functions git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@96 4f64403b-2f21-0410-a795-97e2b3489a10 --- yapp/popwin.cpp | 100 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 48 deletions(-) (limited to 'yapp/popwin.cpp') diff --git a/yapp/popwin.cpp b/yapp/popwin.cpp index cb20dc1..4f9c5a3 100644 --- a/yapp/popwin.cpp +++ b/yapp/popwin.cpp @@ -26,7 +26,7 @@ void SetStartValues() { MONITORINFO mi; mi.cbSize = sizeof(mi); - GetMonitorInfo(hMonitor, &mi); + MyGetMonitorInfo(hMonitor, &mi); wa_rect = mi.rcWork; @@ -188,7 +188,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->barBrush = CreateSolidBrush(darkBg); // make sidebar a dark version of the bg } else { pwd->bkBrush = CreateSolidBrush(colBg); - pwd->barBrush = CreateSolidBrush(colSidebar); + pwd->barBrush = CreateSolidBrush(colSidebar); } if(options.border) pwd->bPen = (HPEN)CreatePen(PS_SOLID, 1, colBorder); @@ -218,12 +218,12 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa #ifdef WS_EX_LAYERED SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); #endif - -#ifdef CS_DROPSHADOW - if (options.drop_shadow) { - SetClassLong(hwnd, GCL_STYLE, CS_DROPSHADOW); - } -#endif + +#ifdef CS_DROPSHADOW + if (options.drop_shadow) { + SetClassLong(hwnd, GCL_STYLE, CS_DROPSHADOW); + } +#endif #ifdef LWA_ALPHA if(MySetLayeredWindowAttributes) { @@ -334,37 +334,37 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa break; case WM_ERASEBKGND: { - HDC hdc = (HDC) wParam; - RECT r, r_bar; - GetClientRect(hwnd, &r); - - // bg - FillRect(hdc, &r, pwd->bkBrush); - // sidebar - r_bar = r; - r_bar.right = r.left + options.sb_width; - FillRect(hdc, &r_bar, pwd->barBrush); - // border - if(options.border) { - - HBRUSH hOldBrush = (HBRUSH)SelectObject(hdc, GetStockObject(NULL_BRUSH)); - HPEN hOldPen = (HPEN)SelectObject(hdc, pwd->bPen); - - int h = 0; - if(options.round) { - int v; - int w=14; - h=(r.right-r.left)>(w*2)?w:(r.right-r.left); - v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top); - h=(hbkBrush); + // sidebar + r_bar = r; + r_bar.right = r.left + options.sb_width; + FillRect(hdc, &r_bar, pwd->barBrush); + // border + if(options.border) { + + HBRUSH hOldBrush = (HBRUSH)SelectObject(hdc, GetStockObject(NULL_BRUSH)); + HPEN hOldPen = (HPEN)SelectObject(hdc, pwd->bPen); + + int h = 0; + if(options.round) { + int v; + int w=14; + h=(r.right-r.left)>(w*2)?w:(r.right-r.left); + v=(r.bottom-r.top)>(w*2)?w:(r.bottom-r.top); + h=(hbkBrush); DeleteObject(pwd->bPen); - DeleteObject(pwd->barBrush); + DeleteObject(pwd->barBrush); KillTimer(hwnd, ID_MOVETIMER); KillTimer(hwnd, ID_CLOSETIMER); @@ -594,13 +594,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if(options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) { AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)pd->lchContact, 0); if(ace && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST)) { - if(ace->bmHeight >= ace->bmWidth) { - pwd->real_av_height = options.av_size; - pwd->real_av_width = (int)(options.av_size * (ace->bmWidth / (double)ace->bmHeight)); - } else { - pwd->real_av_height = (int)(options.av_size * (ace->bmHeight / (double)ace->bmWidth)); - pwd->real_av_width = options.av_size; - } + if(ace->bmHeight >= ace->bmWidth) { + pwd->real_av_height = options.av_size; + pwd->real_av_width = (int)(options.av_size * (ace->bmWidth / (double)ace->bmHeight)); + } else { + pwd->real_av_height = (int)(options.av_size * (ace->bmHeight / (double)ace->bmWidth)); + pwd->real_av_width = options.av_size; + } pwd->have_av = true; pwd->av_height = pwd->real_av_height; } @@ -729,7 +729,11 @@ void InitWindowStack() { MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); MyAnimateWindow=(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); MyMonitorFromRect=(HMONITOR (WINAPI*)(LPCRECT,DWORD))GetProcAddress(hUserDll, "MonitorFromRect"); - MyGetMonitorInfo=(BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfo"); + #if defined( _UNICODE ) + MyGetMonitorInfo=(BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoW"); + #else + MyGetMonitorInfo=(BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoA"); + #endif } } -- cgit v1.2.3