在vc下怎么写监测模块?在哪调用?

来源:百度知道 编辑:UC知道 时间:2024/09/24 22:11:18
我调用雷组件进行下载!怎么监测它是否完成!有个GetTaskInfo()应该写到监测函数里!但不知怎么写监测模块?在哪调用?
void CMp3TideDlg::OnBnClickedButton4()
{//单击下载

HRESULT hRes = ::CoInitialize(NULL);
IAgent *pAgent = NULL;

hRes = CoCreateInstance(__uuidof(Agent), NULL, CLSCTX_INPROC_SERVER, __uuidof(IAgent), (void**)&pAgent);
pAgent->AddTask(_T("http:://*****"),
_T(""),
_T(""), _T(""), _T(""),
1, 0, -1);

}
}

pAgent->CommitTasks();
}
最好写段代码参考

检测模块用try来写,用catch捕获相应的错误。再用throw抛出错误
try {
// code that could throw an exception
}
[ catch (exception-declaration) {
// code that executes when exception-declaration is thrown
// in the try block
}
[catch (exception-declaration) {
// code that handles another exception type
} ] . . . ]
// The following syntax shows a throw expression:
throw [expression]