class CXDlg : public CDialog
{
......
public:
typedef ITaskbarList *LPITaskbarList;
LPITaskbarList pTaskbar;
......
};
Step 2: 初始化 任务栏COM 对象
BOOL CXDlg::OnInitDialog()
{
......
// Initializes the Component Object Model(COM)
CoInitialize(0);
// We call below function since we only need to create one object
CoCreateInstance(
CLSID_TaskbarList,
0,
CLSCTX_INPROC_SERVER,
IID_ITaskbarList,
(void**)&pTaskbar
);
// Below function will initialize the taskbar list object
pTaskbar->HrInit();
......
}
Step 3: 使用:删除/显示 任务栏程序按钮
void CXDlg::OnBnClickedButtonHide()
{
pTaskbar->DeleteTab(this->GetSafeHwnd());
}
void CXDlg::OnBnClickedButtonShow()
{
pTaskbar->AddTab(this->GetSafeHwnd());
}
posted on 2007-04-22 22:45
乔栋 阅读(1558)
评论(2) 编辑 收藏 引用 所属分类:
C++的健身房