如何用程序控制Deskband的显示和隐藏?

huangma163 2006-10-05 02:07:50
像Google桌面搜索一样,可以通过程序控制一个Deskband的显示,而不用在工具栏菜单中选择。
这需要怎么实现?有什么接口/消息?
查了一下MSDN,vista上有一个ITaskDeskband可能可以,但是这个接口在xp中没有,有什么其他方法?
...全文
632 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
huzs_82 2007-03-28
  • 打赏
  • 举报
回复
参看:
http://www.vckbase.com/document/viewdoc/?id=244
http://www.vckbase.com/document/viewdoc/?id=1457
老夏Max 2007-03-27
  • 打赏
  • 举报
回复
http://www.codeproject.com/atl/rbdeskband.asp
http://www.codeproject.com/atl/ietoolbartutorial.asp
wangweixing2000 2007-03-27
  • 打赏
  • 举报
回复
刚才查了一下msdn,下面的应该是正解!:) 蒋兄的代码是添加和删除我想应该也可以实现,但是下面更好些吧!

好久都想把这个问题搞明白,今天看该帖子的驱动下狠心了一下,哈哈!
下面是我贴msdn的一段,大家别介意!
大体的意思是我们的band可以通过IOleCommandTarget给他的site发消息,ms给我们以供了一个途径就是DBID_SHOWONLY,我想这才是整解!

Band objects can send commands to their container through the container's IOleCommandTarget interface. To obtain the interface pointer, call the container's IInputObjectSite::QueryInterface method and ask for IID_IOleCommandTarget. You then send commands to the container with IOleCommandTarget::Exec. The command group is CGID_DeskBand. When a band object's GetBandInfo method is called, the container uses the dwBandID parameter to assign the band object an identifier that is used for three of the commands. Four IOleCommandTarget::Exec command identifiers (IDs) are supported.

DBID_BANDINFOCHANGED
The band's information has changed. Set the pvaIn parameter to the band identifier that was received in the most recent call to GetBandInfo. The container will call the band object's GetBandInfo method to request the updated information.

DBID_MAXIMIZEBAND
Maximize the band. Set the pvaIn parameter to the band identifier that was received in the most recent call to GetBandInfo.

DBID_SHOWONLY
Turn other bands in the container on or off. Set the pvaIn parameter to the VT_UNKNOWN type with one of the following values:

Value Description
pUnk A pointer to the band object's IUnknown interface. All other desk bands will be hidden.
0 Hide all desk bands.
1 Show all desk bands.

DBID_PUSHCHEVRON
wangweixing2000 2007-03-27
  • 打赏
  • 举报
回复
学习一下,也研究一下这个问题。
将兄,//spBandSite->RemoveBand(hr);就可以隐藏band吗?
蒋晟 2007-01-12
  • 打赏
  • 举报
回复
create a COM object in the explorer.exe process using SHLoadInProc. When the object is created, create the band and add it.

Note This function is available through Windows XP SP2 and Windows Server 2003. It is not available in later versions of Windows such as Windows Vista.

HRESULT FinalConstruct()
{
//DebugBreak();
CLSID CLSID_AddressBand = {0x01E04581, 0x4EEE, 0x11d0, 0xBF, 0xE9, 0x00, 0xAA, 0x00, 0x5B, 0x43, 0x83};

CComPtr<IUnknown> spBandService;
CComPtr<IBandSite> spBandSite;

if ( SUCCEEDED(spBandService.CoCreateInstance(CLSID_TrayBandSiteService, NULL)) && SUCCEEDED(spBandService->QueryInterface(&spBandSite)) )
{
CComPtr<IUnknown> spBand;

if ( SUCCEEDED(CoCreateInstance(CLSID_AddressBand, NULL, CLSCTX_INPROC, IID_IUnknown, (void**)&spBand)) )
{
CComPtr<IObjectWithSite> spSite;
if ( SUCCEEDED(spBand->QueryInterface(&spSite)) )
{
spSite->SetSite(spBandSite);
}
HRESULT hr = spBandSite->AddBand(spBand);
ATLTRACE2(atlTraceGeneral, 0, _T("Band:%d\n"), hr);
//spBandSite->RemoveBand(hr);
}
}

spBandSite = NULL;
spBandService = NULL;

return S_OK;
}
The Shell automatically unloads a DLL when the DLL's usage count is zero, but only after the DLL has not been used for a period of time. This inactive period might be unacceptably long at times, especially when a Shell extension DLL is being debugged. For operating systems prior to Windows 2000, you can shorten the inactive period by adding the following information to the registry.

HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\AlwaysUnloadDll

After windows 2000, you can use CoFreeUnusedLibraries to unload it.
ReverseEngineering 2007-01-11
  • 打赏
  • 举报
回复
ding.
lion_wing 2006-11-15
  • 打赏
  • 举报
回复
UP
LiChenYue 2006-11-15
  • 打赏
  • 举报
回复
帮你顶一下,蹭点分!

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧