class CXDlg : public CDialog
{
......
public:
typedef ITaskbarList *LPITaskbarList;
LPITaskbarList pTaskbar;
......
};
Step 2: 初始化 任務(wù)欄COM 對(duì)象
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: 使用:刪除/顯示 任務(wù)欄程序按鈕
void CXDlg::OnBnClickedButtonHide()
{
pTaskbar->DeleteTab(this->GetSafeHwnd());
}
void CXDlg::OnBnClickedButtonShow()
{
pTaskbar->AddTab(this->GetSafeHwnd());
}
posted on 2007-04-22 22:45
喬棟 閱讀(1572)
評(píng)論(2) 編輯 收藏 引用 所屬分類:
C++的健身房