summaryrefslogtreecommitdiff
path: root/plugins/Alarms/src/alarms.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-12-27 19:06:23 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-12-27 19:06:23 +0300
commitec2b6465c9b6475b73f4a28cc658af3507765e80 (patch)
tree0a8ea58bef971ccedb66dbb1af067c8e20a44857 /plugins/Alarms/src/alarms.cpp
parent955c6cd5ad96179f8fab08006027a2e0c0afb3b0 (diff)
Alarms:
- warning fixes; - code cleaning
Diffstat (limited to 'plugins/Alarms/src/alarms.cpp')
-rw-r--r--plugins/Alarms/src/alarms.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp
index 14b2fe39a6..dc7de3ca63 100644
--- a/plugins/Alarms/src/alarms.cpp
+++ b/plugins/Alarms/src/alarms.cpp
@@ -10,7 +10,6 @@ There is no warranty.
#include "stdafx.h"
#include "alarms.h"
-
#define SERVICENAME L"mp"
#define COMMANDPREFIX L"/" SERVICENAME
@@ -52,13 +51,14 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
PUDeletePopup(hWnd);
return TRUE;
}
break;
+
case UM_FREEPLUGINDATA:
return TRUE;
}
@@ -73,44 +73,45 @@ void ShowPopup(MCONTACT hContact, const wchar_t *msg)
POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = hIconList1;
- mir_wstrncpy(ppd.lptzContactName, lpzContactName,MAX_CONTACTNAME);
- mir_wstrncpy(ppd.lptzText, msg, MAX_SECONDLINE);
+ mir_wstrncpy(ppd.lptzContactName, lpzContactName, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lptzText, msg, MAX_SECONDLINE);
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = RGB(0,0,0);
+ ppd.colorText = RGB(0, 0, 0);
ppd.PluginWindowProc = PopupDlgProc;
ppd.PluginData = 0;
ppd.iSeconds = 3;
- //Now that every field has been filled, we want to see the popup.
+ // Now that every field has been filled, we want to see the popup.
PUAddPopupT(&ppd);
}
}
HBITMAP LoadBmpFromIcon(int IdRes)
{
- HICON hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IdRes));
-
- RECT rc;
- BITMAPINFOHEADER bih = {0};
+ HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IdRes));
- HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
+ BITMAPINFOHEADER bih = { 0 };
bih.biSize = sizeof(bih);
bih.biBitCount = 24;
bih.biPlanes = 1;
bih.biCompression = BI_RGB;
bih.biHeight = 16;
bih.biWidth = 20;
+
+ RECT rc;
rc.top = rc.left = 0;
rc.right = bih.biWidth;
rc.bottom = bih.biHeight;
+
HDC hdc = GetDC(NULL);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
+
+ HBRUSH hBkgBrush = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
FillRect(hdcMem, &rc, hBkgBrush);
DrawIconEx(hdcMem, 2, 0, hIcon, 16, 16, 0, NULL, DI_NORMAL);
-
SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
ReleaseDC(NULL, hdc);
@@ -160,7 +161,7 @@ extern "C" int __declspec(dllexport) Load(void)
ccx.dwICC = ICC_DATE_CLASSES;
InitCommonControlsEx(&ccx);
- HookEvent(ME_SYSTEM_MODULESLOADED,MainInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, MainDeInit);
LoadOptions();