ReactOS 0.4.16-dev-905-gc1b8c4f
CTrayBandSite Class Reference
Inheritance diagram for CTrayBandSite:
Collaboration diagram for CTrayBandSite:

Public Member Functions

 AddRef () override
 
 Release () override
 
STDMETHODIMP QueryInterface (IN REFIID riid, OUT LPVOID *ppvObj) override
 
 CTrayBandSite ()
 
virtual ~CTrayBandSite ()
 
STDMETHODIMP OnLoad (IN OUT IStream *pStm, IN REFIID riid, OUT PVOID *pvObj) override
 
STDMETHODIMP OnSave (IN OUT IUnknown *pUnk, IN OUT IStream *pStm) override
 
STDMETHODIMP IsTaskBand (IN IUnknown *punk) override
 
STDMETHODIMP ProcessMessage (IN HWND hWnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam, OUT LRESULT *plResult) override
 
STDMETHODIMP AddContextMenus (IN HMENU hmenu, IN UINT indexMenu, IN UINT idCmdFirst, IN UINT idCmdLast, IN UINT uFlags, OUT IContextMenu **ppcm) override
 
STDMETHODIMP Lock (IN BOOL bLock) override
 
STDMETHODIMP AddBand (IN IUnknown *punk) override
 
STDMETHODIMP EnumBands (IN UINT uBand, OUT DWORD *pdwBandID) override
 
STDMETHODIMP QueryBand (IN DWORD dwBandID, OUT IDeskBand **ppstb, OUT DWORD *pdwState, OUT LPWSTR pszName, IN int cchName) override
 
STDMETHODIMP SetBandState (IN DWORD dwBandID, IN DWORD dwMask, IN DWORD dwState) override
 
STDMETHODIMP RemoveBand (IN DWORD dwBandID) override
 
STDMETHODIMP GetBandObject (IN DWORD dwBandID, IN REFIID riid, OUT VOID **ppv) override
 
STDMETHODIMP SetBandSiteInfo (IN const BANDSITEINFO *pbsinfo) override
 
STDMETHODIMP GetBandSiteInfo (IN OUT BANDSITEINFO *pbsinfo) override
 
virtual BOOL HasTaskBand ()
 
virtual HRESULT Update ()
 
virtual VOID BroadcastOleCommandExec (REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
 
virtual HRESULT FinishInit ()
 
virtual HRESULT Show (IN BOOL bShow)
 
virtual HRESULT LoadFromStream (IN OUT IStream *pStm)
 
virtual IStreamGetUserBandsStream (IN DWORD grfMode)
 
virtual IStreamGetDefaultBandsStream (IN DWORD grfMode)
 
virtual HRESULT Load ()
 
HRESULT _Init (IN ITrayWindow *tray, IN IDeskBand *pTaskBand)
 
- Public Member Functions inherited from IBandSite
HRESULT AddBand ([in] IUnknown *punk)
 
HRESULT EnumBands ([in] UINT uBand, [out] DWORD *pdwBandID)
 
HRESULT QueryBand ([in] DWORD dwBandID, [out] IDeskBand **ppstb, [out] DWORD *pdwState, [out, string, size_is(cchName)] LPWSTR pszName, [in] int cchName)
 
HRESULT SetBandState ([in] DWORD dwBandID, [in] DWORD dwMask, [in] DWORD dwState)
 
HRESULT RemoveBand ([in] DWORD dwBandID)
 
HRESULT GetBandObject ([in] DWORD dwBandID, [in] REFIID riid, [out, iid_is(riid)] void **ppv)
 
HRESULT SetBandSiteInfo ([in] const BANDSITEINFO *pbsinfo)
 
HRESULT GetBandSiteInfo ([in, out] BANDSITEINFO *pbsinfo)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Attributes

volatile LONG m_RefCount
 
CComPtr< ITrayWindow > m_Tray
 
CComPtr< IUnknownm_Inner
 
CComPtr< IBandSitem_BandSite
 
CComPtr< IDeskBandm_TaskBand
 
CComPtr< IWinEventHandler > m_WindowEventHandler
 
CComPtr< IContextMenum_ContextMenu
 
HWND m_Rebar
 
union {
   DWORD   dwFlags
 
   struct {
      DWORD   Locked: 1
 
   } 
 
}; 
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 

Detailed Description

Definition at line 31 of file tbsite.cpp.

Constructor & Destructor Documentation

◆ CTrayBandSite()

CTrayBandSite::CTrayBandSite ( )
inline

Definition at line 112 of file tbsite.cpp.

112 :
113 m_RefCount(0),
115 {
116 }
HWND m_Rebar
Definition: tbsite.cpp:47
volatile LONG m_RefCount
Definition: tbsite.cpp:37
#define NULL
Definition: types.h:112

◆ ~CTrayBandSite()

virtual CTrayBandSite::~CTrayBandSite ( )
inlinevirtual

Definition at line 118 of file tbsite.cpp.

118{ }

Member Function Documentation

◆ _Init()

HRESULT CTrayBandSite::_Init ( IN ITrayWindow *  tray,
IN IDeskBand pTaskBand 
)
inline

Definition at line 652 of file tbsite.cpp.

653 {
657 HRESULT hRet;
658
659 m_Tray = tray;
660 m_TaskBand = pTaskBand;
661
662 /* Create the RebarBandSite */
663 hRet = _CBandSite_CreateInstance(static_cast<IBandSite*>(this), IID_PPV_ARG(IUnknown, &m_Inner));
664 if (FAILED_UNEXPECTEDLY(hRet))
665 return hRet;
666
667 hRet = m_Inner->QueryInterface(IID_PPV_ARG(IBandSite, &m_BandSite));
668 if (FAILED_UNEXPECTEDLY(hRet))
669 return hRet;
670
671 hRet = m_Inner->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_WindowEventHandler));
672 if (FAILED_UNEXPECTEDLY(hRet))
673 return hRet;
674
675 hRet = m_Inner->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDbc));
676 if (FAILED_UNEXPECTEDLY(hRet))
677 return hRet;
678
679
680
681
682 /* Crete the rebar in the tray */
683 hRet = pDbc->SetDeskBarSite(tray);
684 if (FAILED_UNEXPECTEDLY(hRet))
685 return hRet;
686
687 hRet = pDbc->GetWindow(&m_Rebar);
688 if (FAILED_UNEXPECTEDLY(hRet))
689 return hRet;
690
692
693 /* Set the Desk Bar mode to the current one */
694 DWORD dwMode = 0;
695 /* FIXME: We need to set the mode (and update) whenever the user docks
696 the tray window to another monitor edge! */
697 if (!m_Tray->IsHorizontal())
698 dwMode = DBIF_VIEWMODE_VERTICAL;
699
700 hRet = pDbc->SetModeDBC(dwMode);
701
702 /* Load the saved state of the task band site */
703 /* FIXME: We should delay loading shell extensions, also see DBID_DELAYINIT */
704 Load();
705
706 /* Add the task bar band if it hasn't been added while loading */
707 if (!HasTaskBand())
708 {
709 hRet = m_BandSite->AddBand(m_TaskBand);
710 if (FAILED_UNEXPECTEDLY(hRet))
711 return hRet;
712 }
713
714 /* Should we send this after showing it? */
715 Update();
716
717 /* FIXME: When should we send this? Does anyone care anyway? */
718 FinishInit();
719
720 /* Activate the band site */
721 Show(TRUE);
722
723 return S_OK;
724 }
HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv)
Definition: rshell.cpp:186
CComPtr< IWinEventHandler > m_WindowEventHandler
Definition: tbsite.cpp:44
virtual HRESULT FinishInit()
Definition: tbsite.cpp:531
CComPtr< ITrayWindow > m_Tray
Definition: tbsite.cpp:39
virtual HRESULT Load()
Definition: tbsite.cpp:615
CComPtr< IBandSite > m_BandSite
Definition: tbsite.cpp:42
CComPtr< IUnknown > m_Inner
Definition: tbsite.cpp:41
virtual HRESULT Update()
Definition: tbsite.cpp:491
virtual HRESULT Show(IN BOOL bShow)
Definition: tbsite.cpp:539
virtual BOOL HasTaskBand()
Definition: tbsite.cpp:465
CComPtr< IDeskBand > m_TaskBand
Definition: tbsite.cpp:43
#define TRUE
Definition: types.h:120
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define SetWindowStyle(hwnd, val)
Definition: utility.h:153
#define RBS_BANDBORDERS
Definition: commctrl.h:1472
#define IID_PPV_ARG(Itype, ppType)

◆ AddBand()

STDMETHODIMP CTrayBandSite::AddBand ( IN IUnknown punk)
inlineoverride

Definition at line 354 of file tbsite.cpp.

355 {
356 /* Send the DBID_DELAYINIT command to initialize the band to be added */
357 /* FIXME: Should be delayed */
358 IUnknown_Exec(punk, IID_IDeskBand, DBID_DELAYINIT, 0, NULL, NULL);
359
360 HRESULT hr = m_BandSite->AddBand(punk);
362 return hr;
363
364 VARIANT vThemeName;
365 V_VT(&vThemeName) = VT_BSTR;
366 V_BSTR(&vThemeName) = SysAllocString(L"TaskBar");
367 IUnknown_Exec(punk,
368 IID_IDeskBand,
370 0,
371 &vThemeName,
372 NULL);
373
374 SysFreeString(V_BSTR(&vThemeName));
375
376 return S_OK;
377 }
@ VT_BSTR
Definition: compat.h:2303
HRESULT WINAPI IUnknown_Exec(IUnknown *lpUnknown, REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: ordinal.c:1087
#define L(x)
Definition: ntvdm.h:50
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT hr
Definition: shlfolder.c:183
@ DBID_SETWINDOWTHEME
Definition: shobjidl.idl:2534
@ DBID_DELAYINIT
Definition: shobjidl.idl:2532

◆ AddContextMenus()

STDMETHODIMP CTrayBandSite::AddContextMenus ( IN HMENU  hmenu,
IN UINT  indexMenu,
IN UINT  idCmdFirst,
IN UINT  idCmdLast,
IN UINT  uFlags,
OUT IContextMenu **  ppcm 
)
inlineoverride

Definition at line 287 of file tbsite.cpp.

294 {
295 HRESULT hRet;
296
297 if (m_ContextMenu == NULL)
298 {
299 /* Cache the context menu so we don't need to CoCreateInstance all the time... */
301 if (FAILED_UNEXPECTEDLY(hRet))
302 return hRet;
303
305 if (FAILED_UNEXPECTEDLY(hRet))
306 return hRet;
307 }
308
309 if (ppcm != NULL)
310 {
311 *ppcm = m_ContextMenu;
312 (*ppcm)->AddRef();
313 }
314
315 /* Add the menu items */
316 hRet = m_ContextMenu->QueryContextMenu(hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
317 if (FAILED_UNEXPECTEDLY(hRet))
318 return hRet;
319
320 return S_OK;
321 }
HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv)
Definition: rshell.cpp:167
CComPtr< IContextMenu > m_ContextMenu
Definition: tbsite.cpp:45
UINT uFlags
Definition: api.c:59
HRESULT WINAPI IUnknown_SetOwner(IUnknown *iface, IUnknown *pUnk)
Definition: ordinal.c:1385
static HMENU hmenu
Definition: win.c:66

◆ AddRef()

CTrayBandSite::AddRef ( void  )
inlineoverride

Implements IUnknown.

Definition at line 60 of file tbsite.cpp.

61 {
63 }
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by QueryInterface().

◆ BroadcastOleCommandExec()

virtual VOID CTrayBandSite::BroadcastOleCommandExec ( REFGUID  pguidCmdGroup,
DWORD  nCmdID,
DWORD  nCmdExecOpt,
VARIANTARG pvaIn,
VARIANTARG pvaOut 
)
inlinevirtual

Definition at line 501 of file tbsite.cpp.

506 {
507 IOleCommandTarget *pOct;
508 DWORD dwBandID;
509 UINT uBand = 0;
510
511 /* Enumerate all bands */
512 while (SUCCEEDED(m_BandSite->EnumBands(uBand, &dwBandID)))
513 {
514 if (SUCCEEDED(m_BandSite->GetBandObject(dwBandID, IID_PPV_ARG(IOleCommandTarget, &pOct))))
515 {
516 /* Execute the command */
517 pOct->Exec(
518 &pguidCmdGroup,
519 nCmdID,
520 nCmdExecOpt,
521 pvaIn,
522 pvaOut);
523
524 pOct->Release();
525 }
526
527 uBand++;
528 }
529 }
HRESULT Exec([in, unique] const GUID *pguidCmdGroup, [in] DWORD nCmdID, [in] DWORD nCmdexecopt, [in, unique] VARIANT *pvaIn, [in, out, unique] VARIANT *pvaOut)
ULONG Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
unsigned int UINT
Definition: ndis.h:50

Referenced by FinishInit().

◆ EnumBands()

STDMETHODIMP CTrayBandSite::EnumBands ( IN UINT  uBand,
OUT DWORD pdwBandID 
)
inlineoverride

Definition at line 380 of file tbsite.cpp.

383 {
384 return m_BandSite->EnumBands(uBand, pdwBandID);
385 }

◆ FinishInit()

virtual HRESULT CTrayBandSite::FinishInit ( )
inlinevirtual

Definition at line 531 of file tbsite.cpp.

532 {
533 /* Broadcast the DBID_FINISHINIT command */
535
536 return S_OK;
537 }
virtual VOID BroadcastOleCommandExec(REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
Definition: tbsite.cpp:501
@ DBID_FINISHINIT
Definition: shobjidl.idl:2533

Referenced by _Init().

◆ GetBandObject()

STDMETHODIMP CTrayBandSite::GetBandObject ( IN DWORD  dwBandID,
IN REFIID  riid,
OUT VOID **  ppv 
)
inlineoverride

Definition at line 445 of file tbsite.cpp.

449 {
450 return m_BandSite->GetBandObject(dwBandID, riid, ppv);
451 }
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ GetBandSiteInfo()

STDMETHODIMP CTrayBandSite::GetBandSiteInfo ( IN OUT BANDSITEINFO pbsinfo)
inlineoverride

Definition at line 460 of file tbsite.cpp.

461 {
462 return m_BandSite->GetBandSiteInfo(pbsinfo);
463 }

◆ GetDefaultBandsStream()

virtual IStream * CTrayBandSite::GetDefaultBandsStream ( IN DWORD  grfMode)
inlinevirtual

Definition at line 595 of file tbsite.cpp.

596 {
597 HKEY hkStreams;
599
601 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams",
602 &hkStreams) == ERROR_SUCCESS)
603 {
604 Stream = SHOpenRegStreamW(hkStreams,
605 L"Desktop",
606 L"Default Taskbar",
607 grfMode);
608
609 RegCloseKey(hkStreams);
610 }
611
612 return Stream;
613 }
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
static IStream Stream
Definition: htmldoc.c:1115
IStream *WINAPI SHOpenRegStreamW(HKEY hkey, LPCWSTR pszSubkey, LPCWSTR pszValue, DWORD dwMode)
Definition: regstream.c:624
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by Load().

◆ GetUserBandsStream()

virtual IStream * CTrayBandSite::GetUserBandsStream ( IN DWORD  grfMode)
inlinevirtual

Definition at line 575 of file tbsite.cpp.

576 {
577 HKEY hkStreams;
579
581 L"Streams",
582 &hkStreams) == ERROR_SUCCESS)
583 {
584 Stream = SHOpenRegStreamW(hkStreams,
585 L"Desktop",
586 L"TaskbarWinXP",
587 grfMode);
588
589 RegCloseKey(hkStreams);
590 }
591
592 return Stream;
593 }
HKEY hkExplorer
Definition: explorer.cpp:26

Referenced by Load().

◆ HasTaskBand()

virtual BOOL CTrayBandSite::HasTaskBand ( )
inlinevirtual

Definition at line 465 of file tbsite.cpp.

466 {
467 CComPtr<IPersist> pBand;
468 CLSID BandCLSID;
469 DWORD dwBandID;
470 UINT uBand = 0;
471
472 /* Enumerate all bands */
473 while (SUCCEEDED(m_BandSite->EnumBands(uBand, &dwBandID)))
474 {
475 if (dwBandID && SUCCEEDED(m_BandSite->GetBandObject(dwBandID, IID_PPV_ARG(IPersist, &pBand))))
476 {
477 if (SUCCEEDED(pBand->GetClassID(&BandCLSID)))
478 {
479 if (IsEqualGUID(BandCLSID, CLSID_ITaskBand))
480 {
481 return TRUE;
482 }
483 }
484 }
485 uBand++;
486 }
487
488 return FALSE;
489 }
const GUID CLSID_ITaskBand
Definition: taskband.cpp:27
#define FALSE
Definition: types.h:117
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

Referenced by _Init().

◆ IsTaskBand()

STDMETHODIMP CTrayBandSite::IsTaskBand ( IN IUnknown punk)
inlineoverride

Definition at line 207 of file tbsite.cpp.

208 {
209 return IsSameObject(m_BandSite, punk);
210 }
HRESULT IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2)
Definition: util.cpp:11

◆ Load()

virtual HRESULT CTrayBandSite::Load ( )
inlinevirtual

Definition at line 615 of file tbsite.cpp.

616 {
617 IStream *pStm;
618 HRESULT hRet;
619
620 /* Try to load the user's settings */
622 if (pStm != NULL)
623 {
624 hRet = LoadFromStream(pStm);
625
626 TRACE("Loaded user bands settings: 0x%x\n", hRet);
627 pStm->Release();
628 }
629 else
630 hRet = E_FAIL;
631
632 /* If the user's settings couldn't be loaded, try with
633 default settings (ie. when the user logs in for the
634 first time! */
635 if (!SUCCEEDED(hRet))
636 {
638 if (pStm != NULL)
639 {
640 hRet = LoadFromStream(pStm);
641
642 TRACE("Loaded default user bands settings: 0x%x\n", hRet);
643 pStm->Release();
644 }
645 else
646 hRet = E_FAIL;
647 }
648
649 return hRet;
650 }
virtual HRESULT LoadFromStream(IN OUT IStream *pStm)
Definition: tbsite.cpp:553
virtual IStream * GetDefaultBandsStream(IN DWORD grfMode)
Definition: tbsite.cpp:595
virtual IStream * GetUserBandsStream(IN DWORD grfMode)
Definition: tbsite.cpp:575
#define E_FAIL
Definition: ddrawi.h:102
#define STGM_READ
Definition: objbase.h:917
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by _Init().

◆ LoadFromStream()

virtual HRESULT CTrayBandSite::LoadFromStream ( IN OUT IStream pStm)
inlinevirtual

Definition at line 553 of file tbsite.cpp.

554 {
556 HRESULT hRet;
557
559
560 /* We implement the undocumented COM interface IBandSiteStreamCallback
561 that the shell will query so that we can intercept and custom-load
562 the task band when it finds the task band's CLSID (which is internal).
563 This way we can prevent the shell from attempting to CoCreateInstance
564 the (internal) task band, resulting in a failure... */
565 hRet = m_BandSite->QueryInterface(IID_PPV_ARG(IPersistStream, &pPStm));
566 if (SUCCEEDED(hRet))
567 {
568 hRet = pPStm->Load(pStm);
569 TRACE("->Load() returned 0x%x\n", hRet);
570 }
571
572 return hRet;
573 }
#define ASSERT(a)
Definition: mode.c:44

Referenced by Load().

◆ Lock()

STDMETHODIMP CTrayBandSite::Lock ( IN BOOL  bLock)
inlineoverride

Definition at line 324 of file tbsite.cpp.

325 {
326 BOOL bPrevLocked = Locked;
327 BANDSITEINFO bsi;
328 HRESULT hRet;
329
331
332 if (bPrevLocked != bLock)
333 {
334 Locked = bLock;
335
336 bsi.dwMask = BSIM_STYLE;
337 bsi.dwStyle = (Locked ? BSIS_LOCKED | BSIS_NOGRIPPER : BSIS_AUTOGRIPPER);
338
339 hRet = m_BandSite->SetBandSiteInfo(&bsi);
340 if (SUCCEEDED(hRet))
341 {
342 hRet = Update();
343 }
344
345 return hRet;
346 }
347
348 return S_FALSE;
349 }
DWORD Locked
Definition: tbsite.cpp:54
unsigned int BOOL
Definition: ntddk_ex.h:94
#define S_FALSE
Definition: winerror.h:2357

◆ OnLoad()

STDMETHODIMP CTrayBandSite::OnLoad ( IN OUT IStream pStm,
IN REFIID  riid,
OUT PVOID pvObj 
)
inlineoverride

Definition at line 121 of file tbsite.cpp.

125 {
126 LARGE_INTEGER liPosZero;
127 ULARGE_INTEGER liCurrent;
128 CLSID clsid;
129 ULONG ulRead;
130 HRESULT hRet;
131
132 /* NOTE: Callback routine called by the shell while loading the task band
133 stream. We use it to intercept the default behavior when the task
134 band is loaded from the stream.
135
136 NOTE: riid always points to IID_IUnknown! This is because the shell hasn't
137 read anything from the stream and therefore doesn't know what CLSID
138 it's dealing with. We'll have to find it out ourselves by reading
139 the GUID from the stream. */
140
141 /* Read the current position of the stream, we'll have to reset it everytime
142 we read a CLSID that's not the task band... */
143 ZeroMemory(&liPosZero, sizeof(liPosZero));
144 hRet = pStm->Seek(liPosZero, STREAM_SEEK_CUR, &liCurrent);
145
146 if (SUCCEEDED(hRet))
147 {
148 /* Now let's read the CLSID from the stream and see if it's our task band */
149 hRet = pStm->Read(&clsid, (ULONG)sizeof(clsid), &ulRead);
150
151 if (SUCCEEDED(hRet) && ulRead == sizeof(clsid))
152 {
154 {
156 /* We're trying to load the task band! Let's create it... */
157
158 hRet = m_TaskBand->QueryInterface(
159 riid,
160 pvObj);
161 if (SUCCEEDED(hRet))
162 {
163 /* Load the stream */
164 TRACE("IBandSiteStreamCallback::OnLoad intercepted the task band CLSID!\n");
165 }
166
167 return hRet;
168 }
169 }
170 }
171
172 /* Reset the position and let the shell do all the work for us */
173 hRet = pStm->Seek(
174 *(LARGE_INTEGER*) &liCurrent,
175 STREAM_SEEK_SET,
176 NULL);
177 if (SUCCEEDED(hRet))
178 {
179 /* Let the shell handle everything else for us :) */
180 hRet = OleLoadFromStream(pStm,
181 riid,
182 pvObj);
183 }
184
185 if (!SUCCEEDED(hRet))
186 {
187 TRACE("IBandSiteStreamCallback::OnLoad(0x%p, 0x%p, 0x%p) returns 0x%x\n", pStm, riid, pvObj, hRet);
188 }
189
190 return hRet;
191 }
HRESULT WINAPI OleLoadFromStream(IStream *pStm, REFIID iidInterface, void **ppvObj)
Definition: storage32.c:9129
REFCLSID clsid
Definition: msctf.c:82
uint32_t ULONG
Definition: typedefs.h:59
#define ZeroMemory
Definition: winbase.h:1737

◆ OnSave()

STDMETHODIMP CTrayBandSite::OnSave ( IN OUT IUnknown pUnk,
IN OUT IStream pStm 
)
inlineoverride

Definition at line 194 of file tbsite.cpp.

197 {
198 /* NOTE: Callback routine called by the shell while saving the task band
199 stream. We use it to intercept the default behavior when the task
200 band is saved to the stream */
201 /* FIXME: Implement */
202 TRACE("IBandSiteStreamCallback::OnSave(0x%p, 0x%p) returns E_NOTIMPL\n", pUnk, pStm);
203 return E_NOTIMPL;
204 }
#define E_NOTIMPL
Definition: ddrawi.h:99
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ ProcessMessage()

STDMETHODIMP CTrayBandSite::ProcessMessage ( IN HWND  hWnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam,
OUT LRESULT plResult 
)
inlineoverride

Definition at line 213 of file tbsite.cpp.

219 {
220 HRESULT hRet;
221
222 ASSERT(m_Rebar != NULL);
223
224 /* Custom task band behavior */
225 switch (uMsg)
226 {
227 case WM_NOTIFY:
228 {
229 const NMHDR *nmh = (const NMHDR *) lParam;
230
231 if (nmh->hwndFrom == m_Rebar)
232 {
233 switch (nmh->code)
234 {
235 case NM_NCHITTEST:
236 {
237 LPNMMOUSE nmm = (LPNMMOUSE) lParam;
238
239 if (nmm->dwHitInfo == RBHT_CLIENT || nmm->dwHitInfo == RBHT_NOWHERE ||
240 nmm->dwItemSpec == (DWORD_PTR) -1)
241 {
242 /* Make the rebar control appear transparent so the user
243 can drag the tray window */
244 *plResult = HTTRANSPARENT;
245 }
246 return S_OK;
247 }
248
249 case RBN_MINMAX:
250 /* Deny if an Administrator disabled this "feature" */
251 *plResult = (SHRestricted(REST_NOMOVINGBAND) != 0);
252 return S_OK;
253 }
254 }
255
256 //TRACE("ITrayBandSite::ProcessMessage: WM_NOTIFY for 0x%p, From: 0x%p, Code: NM_FIRST-%u...\n", hWnd, nmh->hwndFrom, NM_FIRST - nmh->code);
257 break;
258 }
259 }
260
261 /* Forward to the shell's IWinEventHandler interface to get the default shell behavior! */
263 return E_FAIL;
264
265 /*TRACE("Calling IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p) hWndRebar=0x%p\n", hWnd, uMsg, wParam, lParam, plResult, hWndRebar);*/
266 hRet = m_WindowEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plResult);
267
268#if 0
269 if (FAILED(hRet))
270 {
271 if (uMsg == WM_NOTIFY)
272 {
273 const NMHDR *nmh = (const NMHDR *) lParam;
274 ERR("ITrayBandSite->IWinEventHandler::ProcessMessage: WM_NOTIFY for 0x%p, From: 0x%p, Code: NM_FIRST-%u returned 0x%x\n", hWnd, nmh->hwndFrom, NM_FIRST - nmh->code, hRet);
275 }
276 else
277 {
278 ERR("ITrayBandSite->IWinEventHandler::ProcessMessage(0x%p,0x%x,0x%p,0x%p,0x%p->0x%p) returned: 0x%x\n", hWnd, uMsg, wParam, lParam, plResult, *plResult, hRet);
279 }
280 }
281#endif
282
283 return hRet;
284 }
HWND hWnd
Definition: settings.c:17
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define FAILED(hr)
Definition: intsafe.h:51
#define RBN_MINMAX
Definition: commctrl.h:1638
#define NM_FIRST
Definition: commctrl.h:199
#define RBHT_NOWHERE
Definition: commctrl.h:1691
#define NM_NCHITTEST
Definition: commctrl.h:139
#define RBHT_CLIENT
Definition: commctrl.h:1693
struct tagNMMOUSE * LPNMMOUSE
#define WM_NOTIFY
Definition: richedit.h:61
@ REST_NOMOVINGBAND
Definition: shlobj.h:1698
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:150
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
DWORD_PTR dwItemSpec
Definition: commctrl.h:164
LPARAM dwHitInfo
Definition: commctrl.h:167
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define HTTRANSPARENT
Definition: winuser.h:2476

◆ QueryBand()

STDMETHODIMP CTrayBandSite::QueryBand ( IN DWORD  dwBandID,
OUT IDeskBand **  ppstb,
OUT DWORD pdwState,
OUT LPWSTR  pszName,
IN int  cchName 
)
inlineoverride

Definition at line 388 of file tbsite.cpp.

394 {
395 HRESULT hRet;
396 IDeskBand *pstb = NULL;
397
398 hRet = m_BandSite->QueryBand(
399 dwBandID,
400 &pstb,
401 pdwState,
402 pszName,
403 cchName);
404
405 if (SUCCEEDED(hRet))
406 {
407 hRet = IsSameObject(pstb, m_TaskBand);
408 if (hRet == S_OK)
409 {
410 /* Add the BSSF_UNDELETEABLE flag to pdwState because the task bar band shouldn't be deletable */
411 if (pdwState != NULL)
412 *pdwState |= BSSF_UNDELETEABLE;
413 }
414 else if (!SUCCEEDED(hRet))
415 {
416 pstb->Release();
417 pstb = NULL;
418 }
419
420 if (ppstb != NULL)
421 *ppstb = pstb;
422 }
423 else if (ppstb != NULL)
424 *ppstb = NULL;
425
426 return hRet;
427 }
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2792

◆ QueryInterface()

STDMETHODIMP CTrayBandSite::QueryInterface ( IN REFIID  riid,
OUT LPVOID ppvObj 
)
inlineoverride

Definition at line 77 of file tbsite.cpp.

78 {
79 if (ppvObj == NULL)
80 return E_POINTER;
81
82 if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IBandSiteHelper))
83 {
84 // return IBandSiteStreamCallback's IUnknown
85 *ppvObj = static_cast<IBandSiteStreamCallback*>(this);
86 }
87 else if (IsEqualIID(riid, IID_IBandSite))
88 {
89 *ppvObj = static_cast<IBandSite*>(this);
90 }
91 else if (IsEqualIID(riid, IID_IWinEventHandler))
92 {
93 TRACE("ITaskBandSite: IWinEventHandler queried!\n");
94 *ppvObj = NULL;
95 return E_NOINTERFACE;
96 }
97 else if (m_Inner != NULL)
98 {
99 return m_Inner->QueryInterface(riid, ppvObj);
100 }
101 else
102 {
103 *ppvObj = NULL;
104 return E_NOINTERFACE;
105 }
106
107 AddRef();
108 return S_OK;
109 }
const GUID IID_IUnknown
AddRef() override
Definition: tbsite.cpp:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365

◆ Release()

CTrayBandSite::Release ( void  )
inlineoverride

Implements IUnknown.

Definition at line 66 of file tbsite.cpp.

67 {
69
70 if (Ret == 0)
71 delete this;
72
73 return Ret;
74 }
#define InterlockedDecrement
Definition: armddk.h:52

◆ RemoveBand()

STDMETHODIMP CTrayBandSite::RemoveBand ( IN DWORD  dwBandID)
inlineoverride

Definition at line 439 of file tbsite.cpp.

440 {
441 return m_BandSite->RemoveBand(dwBandID);
442 }

◆ SetBandSiteInfo()

STDMETHODIMP CTrayBandSite::SetBandSiteInfo ( IN const BANDSITEINFO pbsinfo)
inlineoverride

Definition at line 454 of file tbsite.cpp.

455 {
456 return m_BandSite->SetBandSiteInfo(pbsinfo);
457 }

◆ SetBandState()

STDMETHODIMP CTrayBandSite::SetBandState ( IN DWORD  dwBandID,
IN DWORD  dwMask,
IN DWORD  dwState 
)
inlineoverride

Definition at line 430 of file tbsite.cpp.

434 {
435 return m_BandSite->SetBandState(dwBandID, dwMask, dwState);
436 }

◆ Show()

virtual HRESULT CTrayBandSite::Show ( IN BOOL  bShow)
inlinevirtual

Definition at line 539 of file tbsite.cpp.

540 {
542 HRESULT hRet;
543
544 hRet = m_BandSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDbc));
545 if (SUCCEEDED(hRet))
546 {
547 hRet = pDbc->UIActivateDBC(bShow ? DBC_SHOW : DBC_HIDE);
548 }
549
550 return hRet;
551 }
#define DBC_SHOW
Definition: shlobj.h:1063
#define DBC_HIDE
Definition: shlobj.h:1062

Referenced by _Init().

◆ Update()

virtual HRESULT CTrayBandSite::Update ( )
inlinevirtual

Definition at line 491 of file tbsite.cpp.

492 {
493 return IUnknown_Exec(m_Inner,
494 IID_IDeskBand,
496 0,
497 NULL,
498 NULL);
499 }
@ DBID_BANDINFOCHANGED
Definition: shobjidl.idl:2528

Referenced by _Init(), and Lock().

Member Data Documentation

◆ 

union { ... } CTrayBandSite::@86

◆ dwFlags

DWORD CTrayBandSite::dwFlags

Definition at line 51 of file tbsite.cpp.

◆ Locked

DWORD CTrayBandSite::Locked

Definition at line 54 of file tbsite.cpp.

Referenced by Lock().

◆ m_BandSite

◆ m_ContextMenu

CComPtr<IContextMenu> CTrayBandSite::m_ContextMenu
private

Definition at line 45 of file tbsite.cpp.

Referenced by AddContextMenus().

◆ m_Inner

CComPtr<IUnknown> CTrayBandSite::m_Inner
private

Definition at line 41 of file tbsite.cpp.

Referenced by _Init(), QueryInterface(), and Update().

◆ m_Rebar

HWND CTrayBandSite::m_Rebar
private

Definition at line 47 of file tbsite.cpp.

Referenced by _Init(), and ProcessMessage().

◆ m_RefCount

volatile LONG CTrayBandSite::m_RefCount
private

Definition at line 37 of file tbsite.cpp.

Referenced by AddRef(), and Release().

◆ m_TaskBand

CComPtr<IDeskBand> CTrayBandSite::m_TaskBand
private

Definition at line 43 of file tbsite.cpp.

Referenced by _Init(), OnLoad(), and QueryBand().

◆ m_Tray

CComPtr<ITrayWindow> CTrayBandSite::m_Tray
private

Definition at line 39 of file tbsite.cpp.

Referenced by _Init().

◆ m_WindowEventHandler

CComPtr<IWinEventHandler> CTrayBandSite::m_WindowEventHandler
private

Definition at line 44 of file tbsite.cpp.

Referenced by _Init(), and ProcessMessage().


The documentation for this class was generated from the following file: