From 727a0432f5909ba54e6d15010fde94dff825fe5e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 24 Jun 2015 15:02:42 +0000 Subject: fixes for MENUITEMINFO declarations git-svn-id: http://svn.miranda-ng.org/main/trunk@14363 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/clistmenus.cpp | 24 +++++++++++++----------- src/mir_app/src/clisttray.cpp | 20 ++++++++++---------- src/mir_app/src/clui.cpp | 9 ++++++--- src/mir_app/src/genmenu.cpp | 15 ++++++++++----- src/mir_app/src/groups.cpp | 3 ++- src/mir_app/src/meta_services.cpp | 3 ++- 6 files changed, 43 insertions(+), 31 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index 47e2fa473e..8d7725c402 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -379,7 +379,8 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* it if (!itdat) return FALSE; - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU | MIIM_DATA; for (int i = GetMenuItemCount(hMenu) - 1; i >= 0; i--) { GetMenuItemInfo(hMenu, i, TRUE, &mii); @@ -445,25 +446,25 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) MenuItemData it = { 0 }; if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) { - MENUITEMINFO mi = { 0 }; TCHAR d[100]; GetMenuString(it.OwnerMenu, it.position, d, _countof(d), MF_BYPOSITION); - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_STRING | MIIM_STATE; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STRING | MIIM_STATE; if (timi->iconId != -1) { - mi.fMask |= MIIM_BITMAP; + mii.fMask |= MIIM_BITMAP; if (IsWinVerVistaPlus() && IsThemeActive()) { if (timi->hBmp == NULL) timi->hBmp = ConvertIconToBitmap(NULL, timi->parent->m_hMenuIcons, timi->iconId); - mi.hbmpItem = timi->hBmp; + mii.hbmpItem = timi->hBmp; } - else mi.hbmpItem = HBMMENU_CALLBACK; + else mii.hbmpItem = HBMMENU_CALLBACK; } - mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED); - mi.dwTypeData = ptszName; - SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mi); + mii.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED); + mii.dwTypeData = ptszName; + SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mii); } Menu_ModifyItem(timi->mi.root, ptszName); @@ -657,7 +658,8 @@ BOOL FindMenuHanleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* itd BOOL inSub = FALSE; - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU | MIIM_DATA; for (int i = GetMenuItemCount(hMenu) - 1; i >= 0; i--) { GetMenuItemInfo(hMenu, i, TRUE, &mii); diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 688ac9764d..2e45b26994 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -723,16 +723,16 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) HMENU hMenu = GetSubMenu(hMainMenu, 0); TranslateMenu(hMenu); - MENUITEMINFO mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_SUBMENU | MIIM_TYPE; - mi.fType = MFT_STRING; - mi.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); - mi.dwTypeData = TranslateT("&Main menu"); - InsertMenuItem(hMenu, 1, TRUE, &mi); - mi.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); - mi.dwTypeData = TranslateT("&Status"); - InsertMenuItem(hMenu, 2, TRUE, &mi); + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_SUBMENU | MIIM_TYPE; + mii.fType = MFT_STRING; + mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0); + mii.dwTypeData = TranslateT("&Main menu"); + InsertMenuItem(hMenu, 1, TRUE, &mii); + mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0); + mii.dwTypeData = TranslateT("&Status"); + InsertMenuItem(hMenu, 2, TRUE, &mii); SetMenuDefaultItem(hMenu, ID_TRAY_HIDE, FALSE); SetForegroundWindow(msg->hwnd); diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 141ed13b8c..018d4300f4 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -59,7 +59,8 @@ void fnLoadCluiGlobalOpts() static int CluiModulesLoaded(WPARAM, LPARAM) { if (cli.hMenuMain) { - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU; mii.hSubMenu = (HMENU) CallService(MS_CLIST_MENUGETMAIN, 0, 0); SetMenuItemInfo(cli.hMenuMain, 0, TRUE, &mii); @@ -428,7 +429,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (msg) { case WM_NCCREATE: { - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_TYPE | MIIM_DATA; mii.dwItemData = MENU_MIRANDAMENU; mii.fType = MFT_OWNERDRAW; @@ -910,7 +912,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM POINT pt; GetCursorPos(&pt); if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) && (!(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) { - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU; mii.hSubMenu = (HMENU)CallService((pos == 0) ? MS_CLIST_MENUGETMAIN : MS_CLIST_MENUGETSTATUS, 0, 0); SetMenuItemInfo(cli.hMenuMain, pos, TRUE, &mii); diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index 290f30d5bf..4a7036d37a 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -745,7 +745,8 @@ TMO_IntMenuItem *MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi) { - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU | MIIM_DATA; for (int i = GetMenuItemCount(hMenu) - 1; i >= 0; i--) { GetMenuItemInfo(hMenu, i, TRUE, &mii); @@ -764,7 +765,8 @@ static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi) static DWORD GetMenuItemType(HMENU hMenu, int uItem) { - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_TYPE; GetMenuItemInfo(hMenu, uItem, TRUE, &mii); return mii.fType; @@ -772,7 +774,8 @@ static DWORD GetMenuItemType(HMENU hMenu, int uItem) static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, TMO_IntMenuItem* &p) { - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA | MIIM_TYPE; GetMenuItemInfo(hMenu, uItem, TRUE, &mii); p = MO_GetIntMenuItem((HGENMENU)mii.dwItemData); @@ -781,7 +784,8 @@ static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, TMO_IntMenuItem* &p) static void InsertSeparator(HMENU hMenu, int uItem) { - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_TYPE; mii.fType = MFT_SEPARATOR; InsertMenuItem(hMenu, uItem, TRUE, &mii); @@ -944,7 +948,8 @@ HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *par int i = WhereToPlace(hMenu, mi); - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.dwItemData = (LPARAM)pmi; mii.fMask = MIIM_DATA | MIIM_ID | MIIM_STRING; if (pmi->iconId != -1) { diff --git a/src/mir_app/src/groups.cpp b/src/mir_app/src/groups.cpp index 9775eb39ba..c342ca8b8c 100644 --- a/src/mir_app/src/groups.cpp +++ b/src/mir_app/src/groups.cpp @@ -480,7 +480,8 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM) pNextField = dbv.ptszVal + 1; hThisMenu = hRootMenu; - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); do { pBackslash = _tcschr(pNextField, '\\'); if (pBackslash == NULL) { diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 2379458374..20b09ae5c4 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -593,7 +593,8 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam) HMENU hMenu = CreatePopupMenu(); int iDefault = Meta_GetContactNumber(cc, db_mc_getSrmmSub(cc->contactID)); - MENUITEMINFO mii = { sizeof(mii) }; + MENUITEMINFO mii = { 0 }; + mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_STATE | MIIM_STRING; for (int i = 0; i < cc->nSubs; i++) { char *szProto = GetContactProto(cc->pSubs[i]); -- cgit v1.2.3