From 30707c980d1560b358dbf2671a4d2a26a1e8173c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 21:45:37 +0000 Subject: various menu initialization quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewEventNotify/src/menuitem.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'plugins/NewEventNotify/src/menuitem.cpp') diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index 6831c204a1..99e35c4740 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -1,6 +1,6 @@ /* Name: NewEventNotify - Plugin for Miranda IM - File: menuitem.c - Manages item(s) in the Miranda Menu + File: mi.c - Manages item(s) in the Miranda Menu Version: 0.0.4 Description: Notifies you about some events Author: icebreaker, @@ -24,7 +24,6 @@ #include "neweventnotify.h" -CLISTMENUITEM menuitem; HANDLE hMenuitemNotify; BOOL bNotify; @@ -40,14 +39,14 @@ static INT_PTR MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam) int MenuitemUpdate(BOOL bStatus) { - //menuitem.flags = CMIM_FLAGS | (bStatus ? CMIF_CHECKED : 0); - menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(bStatus ? IDI_ENABLED : IDI_DISABLED)); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(bStatus ? IDI_ENABLED : IDI_DISABLED)); if (bStatus) - menuitem.ptszName = TranslateT(MENUITEM_DISABLE); + mi.ptszName = TranslateT(MENUITEM_DISABLE); else - menuitem.ptszName = TranslateT(MENUITEM_ENABLE); - menuitem.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuitemNotify, (LPARAM)&menuitem); + mi.ptszName = TranslateT(MENUITEM_ENABLE); + mi.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuitemNotify, (LPARAM)&mi); return 0; } @@ -56,14 +55,13 @@ int MenuitemInit(BOOL bStatus) { CreateServiceFunction(MS_NEN_MENUNOTIFY, MenuitemNotifyCmd); - ZeroMemory(&menuitem, sizeof(menuitem)); - menuitem.cbSize = sizeof(CLISTMENUITEM); - menuitem.position = 1; - menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)); - menuitem.ptszPopupName = TranslateT("PopUps"); - menuitem.pszService = MS_NEN_MENUNOTIFY; - menuitem.flags = CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; - hMenuitemNotify = Menu_AddMainMenuItem(&menuitem); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 1; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)); + mi.ptszPopupName = TranslateT("PopUps"); + mi.pszService = MS_NEN_MENUNOTIFY; + mi.flags = CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; + hMenuitemNotify = Menu_AddMainMenuItem(&mi); bNotify = bStatus; MenuitemUpdate(bNotify); -- cgit v1.2.3