summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src/ctrl_button.cpp
diff options
context:
space:
mode:
authorRené Schümann <white06tiger@gmail.com>2013-11-05 23:10:23 +0000
committerRené Schümann <white06tiger@gmail.com>2013-11-05 23:10:23 +0000
commit115fea46d525aed87f88f3fd3dc2ce324278465d (patch)
tree801e25e2cc929a53392b00590caa6510f4d00755 /plugins/SendScreenshotPlus/src/ctrl_button.cpp
parent7da36f2428bf5d19720ba8c6f80d5bfcae6ea81d (diff)
* small code cleanup (and kind of x86_64 compatibility) THANKS @Wishmaster (and @person as well for his improvement)
! fixed compatibility with UInfoEx (not smart to unload it's class when we didn't register it.. and later relying on it's existence) git-svn-id: http://svn.miranda-ng.org/main/trunk@6800 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src/ctrl_button.cpp')
-rw-r--r--plugins/SendScreenshotPlus/src/ctrl_button.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
index 62154334a5..c127f85334 100644
--- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp
+++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
@@ -440,8 +440,8 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
case WM_PAINT:
{
PAINTSTRUCT ps;
- HDC hdcPaint;
- if (hdcPaint = BeginPaint(hwndBtn, &ps)) {
+ HDC hdcPaint = BeginPaint(hwndBtn, &ps);
+ if (hdcPaint) {
RECT rcClient; GetClientRect(bct->hwnd, &rcClient);
HDC hdcMem = CreateCompatibleDC(hdcPaint);
HBITMAP hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top);
@@ -616,24 +616,28 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
}
return DefWindowProc(hwndBtn, uMsg, wParam, lParam);
}
-
-VOID CtrlButtonUnloadModule()
+static bool g_init=false;
+void CtrlButtonUnloadModule()
{
+ if(!g_init) return;
+ g_init=false;
DeleteCriticalSection(&csTips);
UnregisterClass(UINFOBUTTONCLASS, hInst);
}
-VOID CtrlButtonLoadModule()
+void CtrlButtonLoadModule()/// @fixme : compatibility with UInfoEx is everything but perfect... we get a huge problem if UInfoEx is unloaded...
{
+ if(ServiceExists("UserInfo/vCard/Export")) return;
WNDCLASSEX wc;
+ g_init=true;
ZeroMemory(&wc, sizeof(wc));
- wc.cbSize = sizeof(wc);
+ wc.cbSize = sizeof(wc);
wc.lpszClassName = UINFOBUTTONCLASS;
wc.lpfnWndProc = Button_WndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.cbWndExtra = sizeof(LPBTNCTRL);
- wc.style = CS_GLOBALCLASS;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.cbWndExtra = sizeof(LPBTNCTRL);
+ wc.style = CS_GLOBALCLASS;
RegisterClassEx(&wc);
InitializeCriticalSection(&csTips);
}