Step 1: 变量定义

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());
}