ReactOS 0.4.15-dev-8146-gdc0ed6d
CTrayBandSite Class Reference
Inheritance diagram for CTrayBandSite:
Collaboration diagram for CTrayBandSite:

Public Member Functions

virtual ULONG STDMETHODCALLTYPE AddRef ()
 
virtual ULONG STDMETHODCALLTYPE Release ()
 
virtual HRESULT STDMETHODCALLTYPE QueryInterface (IN REFIID riid, OUT LPVOID *ppvObj)
 
 CTrayBandSite ()
 
virtual ~CTrayBandSite ()
 
virtual HRESULT STDMETHODCALLTYPE OnLoad (IN OUT IStream *pStm, IN REFIID riid, OUT PVOID *pvObj)
 
virtual HRESULT STDMETHODCALLTYPE OnSave (IN OUT IUnknown *pUnk, IN OUT IStream *pStm)
 
virtual HRESULT STDMETHODCALLTYPE IsTaskBand (IN IUnknown *punk)
 
virtual HRESULT STDMETHODCALLTYPE ProcessMessage (IN HWND hWnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam, OUT LRESULT *plResult)
 
virtual HRESULT STDMETHODCALLTYPE AddContextMenus (IN HMENU hmenu, IN UINT indexMenu, IN UINT idCmdFirst, IN UINT idCmdLast, IN UINT uFlags, OUT IContextMenu **ppcm)
 
virtual HRESULT STDMETHODCALLTYPE Lock (IN BOOL bLock)
 
virtual HRESULT STDMETHODCALLTYPE AddBand (IN IUnknown *punk)
 
virtual HRESULT STDMETHODCALLTYPE EnumBands (IN UINT uBand, OUT DWORD *pdwBandID)
 
virtual HRESULT STDMETHODCALLTYPE QueryBand (IN DWORD dwBandID, OUT IDeskBand **ppstb, OUT DWORD *pdwState, OUT LPWSTR pszName, IN int cchName)
 
virtual HRESULT STDMETHODCALLTYPE SetBandState (IN DWORD dwBandID, IN DWORD dwMask, IN DWORD dwState)
 
virtual HRESULT STDMETHODCALLTYPE RemoveBand (IN DWORD dwBandID)
 
virtual HRESULT STDMETHODCALLTYPE GetBandObject (IN DWORD dwBandID, IN REFIID riid, OUT VOID **ppv)
 
virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo (IN const BANDSITEINFO *pbsinfo)
 
virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo (IN OUT BANDSITEINFO *pbsinfo)
 
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 110 of file tbsite.cpp.

110 :
111 m_RefCount(0),
113 {
114 }
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 116 of file tbsite.cpp.

116{ }

Member Function Documentation

◆ _Init()

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

Definition at line 639 of file tbsite.cpp.

640 {
644 HRESULT hRet;
645
646 m_Tray = tray;
647 m_TaskBand = pTaskBand;
648
649 /* Create the RebarBandSite */
650 hRet = _CBandSite_CreateInstance(static_cast<IBandSite*>(this), IID_PPV_ARG(IUnknown, &m_Inner));
651 if (FAILED_UNEXPECTEDLY(hRet))
652 return hRet;
653
654 hRet = m_Inner->QueryInterface(IID_PPV_ARG(IBandSite, &m_BandSite));
655 if (FAILED_UNEXPECTEDLY(hRet))
656 return hRet;
657
658 hRet = m_Inner->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_WindowEventHandler));
659 if (FAILED_UNEXPECTEDLY(hRet))
660 return hRet;
661
662 hRet = m_Inner->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDbc));
663 if (FAILED_UNEXPECTEDLY(hRet))
664 return hRet;
665
666
667
668
669 /* Crete the rebar in the tray */
670 hRet = pDbc->SetDeskBarSite(tray);
671 if (FAILED_UNEXPECTEDLY(hRet))
672 return hRet;
673
674 hRet = pDbc->GetWindow(&m_Rebar);
675 if (FAILED_UNEXPECTEDLY(hRet))
676 return hRet;
677
679
680 /* Set the Desk Bar mode to the current one */
681 DWORD dwMode = 0;
682 /* FIXME: We need to set the mode (and update) whenever the user docks
683 the tray window to another monitor edge! */
684 if (!m_Tray->IsHorizontal())
685 dwMode = DBIF_VIEWMODE_VERTICAL;
686
687 hRet = pDbc->SetModeDBC(dwMode);
688
689 /* Load the saved state of the task band site */
690 /* FIXME: We should delay loading shell extensions, also see DBID_DELAYINIT */
691 Load();
692
693 /* Add the task bar band if it hasn't been added while loading */
694 if (!HasTaskBand())
695 {
696 hRet = m_BandSite->AddBand(m_TaskBand);
697 if (FAILED_UNEXPECTEDLY(hRet))
698 return hRet;
699 }
700
701 /* Should we send this after showing it? */
702 Update();
703
704 /* FIXME: When should we send this? Does anyone care anyway? */
705 FinishInit();
706
707 /* Activate the band site */
708 Show(TRUE);
709
710 return S_OK;
711 }
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:518
CComPtr< ITrayWindow > m_Tray
Definition: tbsite.cpp:39
virtual HRESULT Load()
Definition: tbsite.cpp:602
CComPtr< IBandSite > m_BandSite
Definition: tbsite.cpp:42
CComPtr< IUnknown > m_Inner
Definition: tbsite.cpp:41
virtual HRESULT Update()
Definition: tbsite.cpp:478
virtual HRESULT Show(IN BOOL bShow)
Definition: tbsite.cpp:526
virtual BOOL HasTaskBand()
Definition: tbsite.cpp:452
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()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::AddBand ( IN IUnknown punk)
inlinevirtual

Definition at line 345 of file tbsite.cpp.

346 {
347 /* Send the DBID_DELAYINIT command to initialize the band to be added */
348 /* FIXME: Should be delayed */
349 IUnknown_Exec(punk, IID_IDeskBand, DBID_DELAYINIT, 0, NULL, NULL);
350
351 HRESULT hr = m_BandSite->AddBand(punk);
353 return hr;
354
355 VARIANT vThemeName;
356 V_VT(&vThemeName) = VT_BSTR;
357 V_BSTR(&vThemeName) = SysAllocString(L"TaskBar");
358 IUnknown_Exec(punk,
359 IID_IDeskBand,
361 0,
362 &vThemeName,
363 NULL);
364
365 SysFreeString(V_BSTR(&vThemeName));
366
367 return S_OK;
368 }
@ 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:1083
#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:2462
@ DBID_DELAYINIT
Definition: shobjidl.idl:2460

◆ AddContextMenus()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::AddContextMenus ( IN HMENU  hmenu,
IN UINT  indexMenu,
IN UINT  idCmdFirst,
IN UINT  idCmdLast,
IN UINT  uFlags,
OUT IContextMenu **  ppcm 
)
inlinevirtual

Definition at line 280 of file tbsite.cpp.

287 {
288 HRESULT hRet;
289
290 if (m_ContextMenu == NULL)
291 {
292 /* Cache the context menu so we don't need to CoCreateInstance all the time... */
294 if (FAILED_UNEXPECTEDLY(hRet))
295 return hRet;
296
298 if (FAILED_UNEXPECTEDLY(hRet))
299 return hRet;
300 }
301
302 if (ppcm != NULL)
303 {
304 *ppcm = m_ContextMenu;
305 (*ppcm)->AddRef();
306 }
307
308 /* Add the menu items */
309 hRet = m_ContextMenu->QueryContextMenu(hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
310 if (FAILED_UNEXPECTEDLY(hRet))
311 return hRet;
312
313 return S_OK;
314 }
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:1381
static HMENU hmenu
Definition: win.c:66

◆ AddRef()

virtual ULONG STDMETHODCALLTYPE CTrayBandSite::AddRef ( void  )
inlinevirtual

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 488 of file tbsite.cpp.

493 {
494 IOleCommandTarget *pOct;
495 DWORD dwBandID;
496 UINT uBand = 0;
497
498 /* Enumerate all bands */
499 while (SUCCEEDED(m_BandSite->EnumBands(uBand, &dwBandID)))
500 {
501 if (SUCCEEDED(m_BandSite->GetBandObject(dwBandID, IID_PPV_ARG(IOleCommandTarget, &pOct))))
502 {
503 /* Execute the command */
504 pOct->Exec(
505 &pguidCmdGroup,
506 nCmdID,
507 nCmdExecOpt,
508 pvaIn,
509 pvaOut);
510
511 pOct->Release();
512 }
513
514 uBand++;
515 }
516 }
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()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::EnumBands ( IN UINT  uBand,
OUT DWORD pdwBandID 
)
inlinevirtual

Definition at line 370 of file tbsite.cpp.

373 {
374 return m_BandSite->EnumBands(uBand, pdwBandID);
375 }

◆ FinishInit()

virtual HRESULT CTrayBandSite::FinishInit ( )
inlinevirtual

Definition at line 518 of file tbsite.cpp.

519 {
520 /* Broadcast the DBID_FINISHINIT command */
522
523 return S_OK;
524 }
virtual VOID BroadcastOleCommandExec(REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
Definition: tbsite.cpp:488
@ DBID_FINISHINIT
Definition: shobjidl.idl:2461

Referenced by _Init().

◆ GetBandObject()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::GetBandObject ( IN DWORD  dwBandID,
IN REFIID  riid,
OUT VOID **  ppv 
)
inlinevirtual

Definition at line 432 of file tbsite.cpp.

436 {
437 return m_BandSite->GetBandObject(dwBandID, riid, ppv);
438 }
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ GetBandSiteInfo()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::GetBandSiteInfo ( IN OUT BANDSITEINFO pbsinfo)
inlinevirtual

Definition at line 446 of file tbsite.cpp.

448 {
449 return m_BandSite->GetBandSiteInfo(pbsinfo);
450 }

◆ GetDefaultBandsStream()

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

Definition at line 582 of file tbsite.cpp.

583 {
584 HKEY hkStreams;
586
588 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams",
589 &hkStreams) == ERROR_SUCCESS)
590 {
591 Stream = SHOpenRegStreamW(hkStreams,
592 L"Desktop",
593 L"Default Taskbar",
594 grfMode);
595
596 RegCloseKey(hkStreams);
597 }
598
599 return Stream;
600 }
#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 562 of file tbsite.cpp.

563 {
564 HKEY hkStreams;
566
568 L"Streams",
569 &hkStreams) == ERROR_SUCCESS)
570 {
571 Stream = SHOpenRegStreamW(hkStreams,
572 L"Desktop",
573 L"TaskbarWinXP",
574 grfMode);
575
576 RegCloseKey(hkStreams);
577 }
578
579 return Stream;
580 }
HKEY hkExplorer
Definition: explorer.cpp:26

Referenced by Load().

◆ HasTaskBand()

virtual BOOL CTrayBandSite::HasTaskBand ( )
inlinevirtual

Definition at line 452 of file tbsite.cpp.

453 {
454 CComPtr<IPersist> pBand;
455 CLSID BandCLSID;
456 DWORD dwBandID;
457 UINT uBand = 0;
458
459 /* Enumerate all bands */
460 while (SUCCEEDED(m_BandSite->EnumBands(uBand, &dwBandID)))
461 {
462 if (dwBandID && SUCCEEDED(m_BandSite->GetBandObject(dwBandID, IID_PPV_ARG(IPersist, &pBand))))
463 {
464 if (SUCCEEDED(pBand->GetClassID(&BandCLSID)))
465 {
466 if (IsEqualGUID(BandCLSID, CLSID_ITaskBand))
467 {
468 return TRUE;
469 }
470 }
471 }
472 uBand++;
473 }
474
475 return FALSE;
476 }
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()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::IsTaskBand ( IN IUnknown punk)
inlinevirtual

Definition at line 202 of file tbsite.cpp.

203 {
204 return IsSameObject(m_BandSite, punk);
205 }
HRESULT IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2)
Definition: util.cpp:11

◆ Load()

virtual HRESULT CTrayBandSite::Load ( )
inlinevirtual

Definition at line 602 of file tbsite.cpp.

603 {
604 IStream *pStm;
605 HRESULT hRet;
606
607 /* Try to load the user's settings */
609 if (pStm != NULL)
610 {
611 hRet = LoadFromStream(pStm);
612
613 TRACE("Loaded user bands settings: 0x%x\n", hRet);
614 pStm->Release();
615 }
616 else
617 hRet = E_FAIL;
618
619 /* If the user's settings couldn't be loaded, try with
620 default settings (ie. when the user logs in for the
621 first time! */
622 if (!SUCCEEDED(hRet))
623 {
625 if (pStm != NULL)
626 {
627 hRet = LoadFromStream(pStm);
628
629 TRACE("Loaded default user bands settings: 0x%x\n", hRet);
630 pStm->Release();
631 }
632 else
633 hRet = E_FAIL;
634 }
635
636 return hRet;
637 }
virtual HRESULT LoadFromStream(IN OUT IStream *pStm)
Definition: tbsite.cpp:540
virtual IStream * GetDefaultBandsStream(IN DWORD grfMode)
Definition: tbsite.cpp:582
virtual IStream * GetUserBandsStream(IN DWORD grfMode)
Definition: tbsite.cpp:562
#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 540 of file tbsite.cpp.

541 {
543 HRESULT hRet;
544
546
547 /* We implement the undocumented COM interface IBandSiteStreamCallback
548 that the shell will query so that we can intercept and custom-load
549 the task band when it finds the task band's CLSID (which is internal).
550 This way we can prevent the shell from attempting to CoCreateInstance
551 the (internal) task band, resulting in a failure... */
552 hRet = m_BandSite->QueryInterface(IID_PPV_ARG(IPersistStream, &pPStm));
553 if (SUCCEEDED(hRet))
554 {
555 hRet = pPStm->Load(pStm);
556 TRACE("->Load() returned 0x%x\n", hRet);
557 }
558
559 return hRet;
560 }
#define ASSERT(a)
Definition: mode.c:44

Referenced by Load().

◆ Lock()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::Lock ( IN BOOL  bLock)
inlinevirtual

Definition at line 316 of file tbsite.cpp.

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

◆ OnLoad()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::OnLoad ( IN OUT IStream pStm,
IN REFIID  riid,
OUT PVOID pvObj 
)
inlinevirtual

Definition at line 118 of file tbsite.cpp.

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

◆ OnSave()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::OnSave ( IN OUT IUnknown pUnk,
IN OUT IStream pStm 
)
inlinevirtual

Definition at line 190 of file tbsite.cpp.

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

◆ ProcessMessage()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::ProcessMessage ( IN HWND  hWnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam,
OUT LRESULT plResult 
)
inlinevirtual

Definition at line 207 of file tbsite.cpp.

213 {
214 HRESULT hRet;
215
216 ASSERT(m_Rebar != NULL);
217
218 /* Custom task band behavior */
219 switch (uMsg)
220 {
221 case WM_NOTIFY:
222 {
223 const NMHDR *nmh = (const NMHDR *) lParam;
224
225 if (nmh->hwndFrom == m_Rebar)
226 {
227 switch (nmh->code)
228 {
229 case NM_NCHITTEST:
230 {
231 LPNMMOUSE nmm = (LPNMMOUSE) lParam;
232
233 if (nmm->dwHitInfo == RBHT_CLIENT || nmm->dwHitInfo == RBHT_NOWHERE ||
234 nmm->dwItemSpec == (DWORD_PTR) -1)
235 {
236 /* Make the rebar control appear transparent so the user
237 can drag the tray window */
238 *plResult = HTTRANSPARENT;
239 }
240 return S_OK;
241 }
242
243 case RBN_MINMAX:
244 /* Deny if an Administrator disabled this "feature" */
245 *plResult = (SHRestricted(REST_NOMOVINGBAND) != 0);
246 return S_OK;
247 }
248 }
249
250 //TRACE("ITrayBandSite::ProcessMessage: WM_NOTIFY for 0x%p, From: 0x%p, Code: NM_FIRST-%u...\n", hWnd, nmh->hwndFrom, NM_FIRST - nmh->code);
251 break;
252 }
253 }
254
255 /* Forward to the shell's IWinEventHandler interface to get the default shell behavior! */
257 return E_FAIL;
258
259 /*TRACE("Calling IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p) hWndRebar=0x%p\n", hWnd, uMsg, wParam, lParam, plResult, hWndRebar);*/
260 hRet = m_WindowEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plResult);
261
262#if 0
263 if (FAILED(hRet))
264 {
265 if (uMsg == WM_NOTIFY)
266 {
267 const NMHDR *nmh = (const NMHDR *) lParam;
268 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);
269 }
270 else
271 {
272 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);
273 }
274 }
275#endif
276
277 return hRet;
278 }
HWND hWnd
Definition: settings.c:17
#define ERR(fmt,...)
Definition: debug.h:113
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:1683
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:146
UINT code
Definition: winuser.h:3159
HWND hwndFrom
Definition: winuser.h:3157
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:2473

◆ QueryBand()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::QueryBand ( IN DWORD  dwBandID,
OUT IDeskBand **  ppstb,
OUT DWORD pdwState,
OUT LPWSTR  pszName,
IN int  cchName 
)
inlinevirtual

Definition at line 377 of file tbsite.cpp.

383 {
384 HRESULT hRet;
385 IDeskBand *pstb = NULL;
386
387 hRet = m_BandSite->QueryBand(
388 dwBandID,
389 &pstb,
390 pdwState,
391 pszName,
392 cchName);
393
394 if (SUCCEEDED(hRet))
395 {
396 hRet = IsSameObject(pstb, m_TaskBand);
397 if (hRet == S_OK)
398 {
399 /* Add the BSSF_UNDELETEABLE flag to pdwState because the task bar band shouldn't be deletable */
400 if (pdwState != NULL)
401 *pdwState |= BSSF_UNDELETEABLE;
402 }
403 else if (!SUCCEEDED(hRet))
404 {
405 pstb->Release();
406 pstb = NULL;
407 }
408
409 if (ppstb != NULL)
410 *ppstb = pstb;
411 }
412 else if (ppstb != NULL)
413 *ppstb = NULL;
414
415 return hRet;
416 }
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767

◆ QueryInterface()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::QueryInterface ( IN REFIID  riid,
OUT LPVOID ppvObj 
)
inlinevirtual

Definition at line 75 of file tbsite.cpp.

76 {
77 if (ppvObj == NULL)
78 return E_POINTER;
79
80 if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IBandSiteHelper))
81 {
82 // return IBandSiteStreamCallback's IUnknown
83 *ppvObj = static_cast<IBandSiteStreamCallback*>(this);
84 }
85 else if (IsEqualIID(riid, IID_IBandSite))
86 {
87 *ppvObj = static_cast<IBandSite*>(this);
88 }
89 else if (IsEqualIID(riid, IID_IWinEventHandler))
90 {
91 TRACE("ITaskBandSite: IWinEventHandler queried!\n");
92 *ppvObj = NULL;
93 return E_NOINTERFACE;
94 }
95 else if (m_Inner != NULL)
96 {
97 return m_Inner->QueryInterface(riid, ppvObj);
98 }
99 else
100 {
101 *ppvObj = NULL;
102 return E_NOINTERFACE;
103 }
104
105 AddRef();
106 return S_OK;
107 }
const GUID IID_IUnknown
virtual ULONG STDMETHODCALLTYPE AddRef()
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()

virtual ULONG STDMETHODCALLTYPE CTrayBandSite::Release ( void  )
inlinevirtual

Implements IUnknown.

Definition at line 65 of file tbsite.cpp.

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

◆ RemoveBand()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::RemoveBand ( IN DWORD  dwBandID)
inlinevirtual

Definition at line 426 of file tbsite.cpp.

428 {
429 return m_BandSite->RemoveBand(dwBandID);
430 }

◆ SetBandSiteInfo()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::SetBandSiteInfo ( IN const BANDSITEINFO pbsinfo)
inlinevirtual

Definition at line 440 of file tbsite.cpp.

442 {
443 return m_BandSite->SetBandSiteInfo(pbsinfo);
444 }

◆ SetBandState()

virtual HRESULT STDMETHODCALLTYPE CTrayBandSite::SetBandState ( IN DWORD  dwBandID,
IN DWORD  dwMask,
IN DWORD  dwState 
)
inlinevirtual

Definition at line 418 of file tbsite.cpp.

422 {
423 return m_BandSite->SetBandState(dwBandID, dwMask, dwState);
424 }

◆ Show()

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

Definition at line 526 of file tbsite.cpp.

527 {
529 HRESULT hRet;
530
531 hRet = m_BandSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDbc));
532 if (SUCCEEDED(hRet))
533 {
534 hRet = pDbc->UIActivateDBC(bShow ? DBC_SHOW : DBC_HIDE);
535 }
536
537 return hRet;
538 }
#define DBC_SHOW
Definition: shlobj.h:1055
#define DBC_HIDE
Definition: shlobj.h:1054

Referenced by _Init().

◆ Update()

virtual HRESULT CTrayBandSite::Update ( )
inlinevirtual

Definition at line 478 of file tbsite.cpp.

479 {
480 return IUnknown_Exec(m_Inner,
481 IID_IDeskBand,
483 0,
484 NULL,
485 NULL);
486 }
@ DBID_BANDINFOCHANGED
Definition: shobjidl.idl:2456

Referenced by _Init(), and Lock().

Member Data Documentation

◆ 

union { ... } CTrayBandSite::@94

◆ 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: