diff --git a/SuiteExterns.cpp b/SuiteExterns.cpp index 23e3dbb..863903f 100644 --- a/SuiteExterns.cpp +++ b/SuiteExterns.cpp @@ -11,6 +11,7 @@ pSHCreateDirectory fnSHCreateDirectory=NULL; pWICConvertBitmapSource fnWICConvertBitmapSource=NULL; pSHGetStockIconInfo fnSHGetStockIconInfo=NULL; pSetMenuInfo fnSetMenuInfo=NULL; +pGetMenuInfo fnGetMenuInfo=NULL; std::unique_ptr SuiteExterns::instance; @@ -71,6 +72,7 @@ void SuiteExterns::LoadFunctions() if (hUser32) { fnChangeWindowMessageFilter=(pChangeWindowMessageFilter)GetProcAddress(hUser32, "ChangeWindowMessageFilter"); fnSetMenuInfo=(pSetMenuInfo)GetProcAddress(hUser32, "SetMenuInfo"); + fnGetMenuInfo=(pGetMenuInfo)GetProcAddress(hUser32, "GetMenuInfo"); } if (hWincodec) { diff --git a/SuiteExterns.h b/SuiteExterns.h index 510d12f..2fcb765 100644 --- a/SuiteExterns.h +++ b/SuiteExterns.h @@ -44,6 +44,7 @@ typedef HRESULT (WINAPI *pSHGetStockIconInfo)(SHSTOCKICONID siid, UINT uFlags, S typedef BOOL (WINAPI *pChangeWindowMessageFilter)(UINT message, DWORD dwFlag); typedef HRESULT (WINAPI *pWICConvertBitmapSource)(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst); typedef BOOL (WINAPI *pSetMenuInfo)(HMENU hmenu, LPCMENUINFO lpcmi); +typedef BOOL (WINAPI *pGetMenuInfo)(HMENU hmenu, LPCMENUINFO lpcmi); #endif //SUITEEXTERNS_H diff --git a/SuiteMain.cpp b/SuiteMain.cpp index 2165c91..704b434 100644 --- a/SuiteMain.cpp +++ b/SuiteMain.cpp @@ -110,7 +110,11 @@ int SuiteMain(HINSTANCE hInstance, SuiteSettings *settings) if (!elev_req) SnkIcon->RemoveIconMenu(IDM_ELEVATE, MF_BYCOMMAND); HBITMAP uac_bitmap=NULL; if (elev_req&&(uac_bitmap=GetUacShieldBitmap())) { - //SnkIcon->SetIconMenuInfo(MNS_CHECKORBMP); + MENUINFO mi={sizeof(MENUINFO), MIM_STYLE}; + if (SnkIcon->GetIconMenuInfo(&mi)) { + mi.dwStyle|=MNS_CHECKORBMP; + SnkIcon->SetIconMenuInfo(&mi); + } //ModifyMenu doesn't work here - it just replaces text with bitmap MENUITEMINFO mii={sizeof(MENUITEMINFO)}; mii.fMask=MIIM_BITMAP; diff --git a/TaskbarNotificationAreaIcon.cpp b/TaskbarNotificationAreaIcon.cpp index 1687acc..7d5523b 100644 --- a/TaskbarNotificationAreaIcon.cpp +++ b/TaskbarNotificationAreaIcon.cpp @@ -11,6 +11,7 @@ TskbrNtfAreaIcon::WmEndsessionTrueFn TskbrNtfAreaIcon::OnWmEndsessionTrue; extern pChangeWindowMessageFilter fnChangeWindowMessageFilter; extern pSetMenuInfo fnSetMenuInfo; +extern pGetMenuInfo fnGetMenuInfo; TskbrNtfAreaIcon* TskbrNtfAreaIcon::MakeInstance(HINSTANCE hInstance, UINT icon_wm, const wchar_t* icon_tooltip, UINT icon_resid, const wchar_t* icon_class, UINT icon_menuid, UINT default_menuid, WmCommandFn OnWmCommand, WmCloseFn OnWmClose, WmEndsessionTrueFn OnWmEndsessionTrue) { @@ -229,6 +230,14 @@ BOOL TskbrNtfAreaIcon::SetIconMenuInfo(LPCMENUINFO lpcmi) return fnSetMenuInfo(icon_menu, lpcmi); } +BOOL TskbrNtfAreaIcon::GetIconMenuInfo(LPCMENUINFO lpcmi) +{ + if (!valid||!fnGetMenuInfo) + return FALSE; + + return fnGetMenuInfo(icon_menu, lpcmi); +} + HWND TskbrNtfAreaIcon::GetIconWindow() { if (valid) diff --git a/TaskbarNotificationAreaIcon.h b/TaskbarNotificationAreaIcon.h index ad5045a..69a9435 100644 --- a/TaskbarNotificationAreaIcon.h +++ b/TaskbarNotificationAreaIcon.h @@ -55,6 +55,7 @@ class TskbrNtfAreaIcon { BOOL CheckIconMenuRadioItem(UINT idFirst, UINT idLast, UINT idCheck, UINT uFlags); UINT GetIconMenuState(UINT uId, UINT uFlags); BOOL SetIconMenuInfo(LPCMENUINFO lpcmi); + BOOL GetIconMenuInfo(LPCMENUINFO lpcmi); ~TskbrNtfAreaIcon(); TskbrNtfAreaIcon(const TskbrNtfAreaIcon&)=delete; //Get rid of default copy constructor