ReactOS
0.4.17-dev-357-ga8f14ff
startmnu.cpp
Go to the documentation of this file.
1
/*
2
* ReactOS Explorer
3
*
4
* Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#include "
precomp.h
"
22
23
HRESULT
24
UpdateStartMenu
(
IN
OUT
IMenuPopup
*pMenuPopup,
25
IN
HBITMAP
hbmBanner
OPTIONAL
,
26
IN
BOOL
bSmallIcons,
27
IN
BOOL
bRefresh)
28
{
29
CComPtr<IBanneredBar>
pbb;
30
HRESULT
hRet;
31
32
hRet = pMenuPopup->
QueryInterface
(
IID_PPV_ARG
(IBanneredBar, &pbb));
33
if
(
SUCCEEDED
(hRet))
34
{
35
hRet = pbb->SetBitmap(hbmBanner);
36
37
/* Update the icon size */
38
hRet = pbb->SetIconSize(bSmallIcons ?
BMICON_SMALL
:
BMICON_LARGE
);
39
}
40
41
if
(bRefresh)
42
{
43
FIXME
(
"Refresh the Start menu with communicating with SHELL32\n"
);
44
// TODO: TRAYCMD_RELOAD_STARTMENUCFG
45
}
46
47
return
hRet;
48
}
49
50
IMenuPopup
*
51
CreateStartMenu
(
IN
ITrayWindow *Tray,
52
OUT
IMenuBand
**ppMenuBand,
53
IN
HBITMAP
hbmBanner
OPTIONAL
,
54
IN
BOOL
bSmallIcons)
55
{
56
HRESULT
hr
;
57
CComPtr<IMenuPopup>
pMp;
58
CComPtr<IUnknown>
pSms;
59
CComPtr<IMenuBand>
pMb;
60
CComPtr<IInitializeObject>
pIo;
61
CComPtr<IUnknown>
pUnk
;
62
CComPtr<IBandSite>
pBs;
63
DWORD
dwBandId = 0;
64
65
hr
=
CStartMenuSite_CreateInstance
(Tray,
IID_PPV_ARG
(
IUnknown
, &pSms));
66
if
(
FAILED_UNEXPECTEDLY
(
hr
))
67
return
NULL
;
68
69
hr
=
_CStartMenu_CreateInstance
(
IID_PPV_ARG
(
IMenuPopup
, &pMp));
70
if
(
FAILED_UNEXPECTEDLY
(
hr
))
71
return
NULL
;
72
73
/* Set the menu site so we can handle messages */
74
hr
=
IUnknown_SetSite
(pMp, pSms);
75
if
(
FAILED_UNEXPECTEDLY
(
hr
))
76
return
NULL
;
77
78
/* Initialize the menu object */
79
hr
= pMp->QueryInterface(
IID_PPV_ARG
(IInitializeObject, &pIo));
80
if
(
SUCCEEDED
(
hr
))
81
hr
= pIo->Initialize();
82
else
83
hr
=
S_OK
;
84
85
/* Everything is initialized now. Let's get the IMenuBand interface. */
86
if
(
FAILED_UNEXPECTEDLY
(
hr
))
87
return
NULL
;
88
89
hr
= pMp->GetClient(&
pUnk
);
90
if
(
FAILED_UNEXPECTEDLY
(
hr
))
91
return
NULL
;
92
93
hr
=
pUnk
->
QueryInterface
(
IID_PPV_ARG
(
IBandSite
, &pBs));
94
if
(
FAILED_UNEXPECTEDLY
(
hr
))
95
return
NULL
;
96
97
/* Finally we have the IBandSite interface, there's only one
98
band in it that apparently provides the IMenuBand interface */
99
hr
= pBs->EnumBands(0, &dwBandId);
100
if
(
FAILED_UNEXPECTEDLY
(
hr
))
101
return
NULL
;
102
103
hr
= pBs->GetBandObject(dwBandId,
IID_PPV_ARG
(
IMenuBand
, &pMb));
104
if
(
FAILED_UNEXPECTEDLY
(
hr
))
105
return
NULL
;
106
107
UpdateStartMenu
(pMp, hbmBanner, bSmallIcons,
FALSE
);
108
109
*ppMenuBand = pMb.
Detach
();
110
111
return
pMp.
Detach
();
112
}
FIXME
#define FIXME(fmt,...)
Definition:
precomp.h:53
CStartMenuSite_CreateInstance
HRESULT CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID &riid, PVOID *ppv)
Definition:
startmnusite.cpp:375
_CStartMenu_CreateInstance
HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv)
Definition:
rshell.cpp:32
ATL::CComPtr
Definition:
atlcomcli.h:72
ATL::CComPtr::Detach
T * Detach()
Definition:
atlcomcli.h:186
hr
HRESULT hr
Definition:
delayimp.cpp:582
NULL
#define NULL
Definition:
types.h:112
FALSE
#define FALSE
Definition:
types.h:117
IUnknown_SetSite
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition:
main.c:222
FAILED_UNEXPECTEDLY
#define FAILED_UNEXPECTEDLY
Definition:
utils.cpp:33
pUnk
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition:
dplayx.c:30
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
HRESULT
Definition:
metahost.idl:58
IBandSite
Definition:
shobjidl.idl:2698
IMenuBand
Definition:
shobjidl.idl:2741
IMenuPopup
Definition:
shobjidl.idl:2603
IUnknown
Definition:
unknwn.idl:39
IUnknown::QueryInterface
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
nsISupports::QueryInterface
nsresult QueryInterface(nsIIDRef riid, void **result)
S_OK
#define S_OK
Definition:
intsafe.h:52
SUCCEEDED
#define SUCCEEDED(hr)
Definition:
intsafe.h:50
HBITMAP
static HBITMAP
Definition:
button.c:44
BMICON_SMALL
@ BMICON_SMALL
Definition:
shlobj_undoc.h:168
BMICON_LARGE
@ BMICON_LARGE
Definition:
shlobj_undoc.h:167
UpdateStartMenu
HRESULT UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup, IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons, IN BOOL bRefresh)
Definition:
startmnu.cpp:24
CreateStartMenu
IMenuPopup * CreateStartMenu(IN ITrayWindow *Tray, OUT IMenuBand **ppMenuBand, IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons)
Definition:
startmnu.cpp:51
OPTIONAL
PULONG MinorVersion OPTIONAL
Definition:
CrossNt.h:68
IN
#define IN
Definition:
typedefs.h:39
OUT
#define OUT
Definition:
typedefs.h:40
precomp.h
IID_PPV_ARG
#define IID_PPV_ARG(Itype, ppType)
Definition:
xmldomparser.hpp:61
base
shell
explorer
startmnu.cpp
Generated on Mon Jun 22 2026 06:03:26 for ReactOS by
1.9.6