Skip to content

Commit

Permalink
Fix for classic theme
Browse files Browse the repository at this point in the history
  • Loading branch information
lcferrum committed Nov 24, 2017
1 parent 2320715 commit 1cd054a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions SuiteExterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pSHCreateDirectory fnSHCreateDirectory=NULL;
pWICConvertBitmapSource fnWICConvertBitmapSource=NULL;
pSHGetStockIconInfo fnSHGetStockIconInfo=NULL;
pSetMenuInfo fnSetMenuInfo=NULL;
pGetMenuInfo fnGetMenuInfo=NULL;

std::unique_ptr<SuiteExterns> SuiteExterns::instance;

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions SuiteExterns.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion SuiteMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions TaskbarNotificationAreaIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions TaskbarNotificationAreaIcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1cd054a

Please sign in to comment.