@@ -37,6 +37,9 @@ Implements the navigation band of the cabinet window
3737 Implement Save
3838*/
3939
40+ // Unique GUID of the DLL where this CAddressBand is implemented so we can tell if it's really us
41+ static const GUID THISMODULE_GUID = { 0x60ebab6e , 0x2e4b , 0x42f6 , { 0x8a ,0xbc ,0x80 ,0x73 ,0x1c ,0xa6 ,0x42 ,0x02 } };
42+
4043CAddressBand::CAddressBand ()
4144{
4245 fEditControl = NULL ;
@@ -49,6 +52,20 @@ CAddressBand::~CAddressBand()
4952{
5053}
5154
55+ BOOL CAddressBand::ShouldShowGoButton ()
56+ {
57+ return SHRegGetBoolUSValueW (L" Software\\ Microsoft\\ Internet Explorer\\ Main" , L" ShowGoButton" , FALSE , TRUE );
58+ }
59+
60+ BOOL CAddressBand::IsGoButtonVisible (IUnknown *pUnkBand)
61+ {
62+ CComPtr<IAddressBand> pAB;
63+ IUnknown_QueryService (pUnkBand, THISMODULE_GUID, IID_PPV_ARG (IAddressBand, &pAB));
64+ if (pAB)
65+ return static_cast <CAddressBand*>(pAB.p )->fGoButtonShown ;
66+ return ShouldShowGoButton (); // We don't know, return the global state
67+ }
68+
5269void CAddressBand::FocusChange (BOOL bFocus)
5370{
5471// m_bFocus = bFocus;
@@ -168,7 +185,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
168185 if (FAILED_UNEXPECTEDLY (hResult))
169186 return hResult;
170187
171- fGoButtonShown = SHRegGetBoolUSValueW ( L" Software \\ Microsoft \\ Internet Explorer \\ Main " , L" ShowGoButton " , FALSE , TRUE );
188+ fGoButtonShown = ShouldShowGoButton ( );
172189 if (fGoButtonShown )
173190 CreateGoButton ();
174191
@@ -365,7 +382,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
365382 case WM_COMMAND:
366383 if (wParam == IDM_TOOLBARS_GOBUTTON)
367384 {
368- fGoButtonShown = !SHRegGetBoolUSValueW ( L" Software \\ Microsoft \\ Internet Explorer \\ Main " , L" ShowGoButton " , FALSE , TRUE );
385+ fGoButtonShown = !IsGoButtonVisible ( static_cast <IAddressBand*>( this ) );
369386 SHRegSetUSValueW (L" Software\\ Microsoft\\ Internet Explorer\\ Main" , L" ShowGoButton" , REG_SZ, fGoButtonShown ? (LPVOID)L" yes" : (LPVOID)L" no" , fGoButtonShown ? 8 : 6 , SHREGSET_FORCE_HKCU);
370387 if (!fGoButton )
371388 CreateGoButton ();
@@ -421,6 +438,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::Refresh(long param8)
421438
422439HRESULT STDMETHODCALLTYPE CAddressBand::QueryService (REFGUID guidService, REFIID riid, void **ppvObject)
423440{
441+ if (guidService == THISMODULE_GUID)
442+ return QueryInterface (riid, ppvObject);
424443 return E_NOTIMPL;
425444}
426445
0 commit comments