From c4582dd65b444e5dae29ada7cc3f6c9a9c20edf3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 2 Dec 2012 18:19:49 +0000 Subject: new easy standard way of registering icons: Icon_Register git-svn-id: http://svn.miranda-ng.org/main/trunk@2601 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AddContactPlus/src/main.cpp | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'plugins/AddContactPlus/src/main.cpp') diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 61f3c1ed38..71d711bde8 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -22,8 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., HINSTANCE hInst; int hLangpack; -static HANDLE hModulesLoaded = 0, hChangedIcons = 0, hAccListChanged = 0, - hMainMenuItem = 0, hToolBarItem = 0, hService = 0; +static HANDLE hMainMenuItem = 0, hToolBarItem = 0; HANDLE hIconLibItem; HWND hAddDlg; @@ -134,20 +133,13 @@ static int CreateButton(WPARAM, LPARAM) return 0; } +static IconItem icon = { LPGEN("Add Contact"), ICON_ADD, IDI_ADDCONTACT }; + static int OnModulesLoaded(WPARAM, LPARAM) { - TCHAR szFile[MAX_PATH]; - GetModuleFileName(hInst, szFile, MAX_PATH); - - SKINICONDESC sid = { sizeof(sid) }; - sid.flags = SIDF_ALL_TCHAR; - sid.ptszDefaultFile = szFile; - sid.ptszSection = LPGENT("AddContact+"); - sid.iDefaultIndex = -IDI_ADDCONTACT; - sid.ptszDescription = LPGENT("Add Contact"); - sid.pszName = ICON_ADD; - hIconLibItem = Skin_AddIcon(&sid); - hChangedIcons = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); + Icon_Register(hInst, LPGEN("AddContact+"), &icon, 1); + + HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged); HOTKEYDESC hkd = {0}; hkd.cbSize = sizeof(hkd); @@ -174,19 +166,14 @@ extern "C" int __declspec(dllexport) Load(void) icex.dwICC = ICC_USEREX_CLASSES; InitCommonControlsEx(&icex); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - hAccListChanged = HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged); - hService = CreateServiceFunction(MS_ADDCONTACTPLUS_SHOW, AddContactPlusDialog); - + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged); + + CreateServiceFunction(MS_ADDCONTACTPLUS_SHOW, AddContactPlusDialog); return 0; } extern "C" int __declspec(dllexport) Unload(void) { - UnhookEvent(hModulesLoaded); - UnhookEvent(hChangedIcons); - UnhookEvent(hAccListChanged); - DestroyServiceFunction(hService); - return 0; } -- cgit v1.2.3