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/Restart/src/restart.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'plugins/Restart/src/restart.cpp') diff --git a/plugins/Restart/src/restart.cpp b/plugins/Restart/src/restart.cpp index c4215794a2..ef3dfd383c 100644 --- a/plugins/Restart/src/restart.cpp +++ b/plugins/Restart/src/restart.cpp @@ -12,7 +12,7 @@ HINSTANCE hInst; int hLangpack; -HANDLE hIconHandle, hRestartMe; +HANDLE hRestartMe; PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), @@ -53,28 +53,21 @@ static INT_PTR RestartMe(WPARAM wParam, LPARAM lParam) return 0; } +static IconItem icon = { LPGEN("Restart"), "rst_restart_icon", IDI_RESTARTICON }; + extern "C" __declspec(dllexport) int Load(void) { mir_getLP( &pluginInfo ); - TCHAR szFile[MAX_PATH]; - GetModuleFileName(hInst, szFile, MAX_PATH); - // IcoLib support - SKINICONDESC sid = { sizeof(sid) }; - sid.ptszDefaultFile = szFile; - sid.flags = SIDF_ALL_TCHAR; - sid.ptszSection = _T("Restart Plugin"); - sid.ptszDescription = _T("Restart"); - sid.pszName = "rst_restart_icon"; - sid.iDefaultIndex = -IDI_RESTARTICON; - hIconHandle = Skin_AddIcon(&sid); + Icon_Register(hInst, "Restart Plugin", &icon, 1); hRestartMe = CreateServiceFunction("System/RestartMe", RestartMe); + CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -0x7FFFFFFF; mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR; - mi.icolibItem = hIconHandle; + mi.icolibItem = icon.hIcolib; mi.ptszName = _T("Restart"); mi.pszService = "System/RestartMe"; Menu_AddMainMenuItem(&mi); -- cgit v1.2.3