Есть поток, в функции run которого используется функционал http://disphelper.sourceforge.net/'а.
Данный функционал реализует запрос к WMI с целью мониторинга системных событий:
try
{
const wchar_t* Query=(const wchar_t *)this->TriggerRequest.utf16();
dhCheck( dhGetObject(L"winmgmts:{impersonationLevel=impersonate,(Security)}!\\\\.\\root\\cimv2",NULL, &wmiSvc) );
dhCheck( dhGetValue(L"%o", &wmiEventSrc, wmiSvc, L".ExecNotificationQuery(%S)",Query) );
emit this->TriggerState(this->TriggerName,1);
while (TRUE)
{
CDispPtr wmiLatestEvent;
dhCheck( dhGetValue(L"%o", &wmiLatestEvent, wmiEventSrc, L".NextEvent") );
emit this->Triggered(this->TriggerName,this->GenerateTriggerMsg(wmiLatestEvent),this->TriggerIcon);
wmiLatestEvent.Dispose();
}
}
catch (string errstr)
{
ErrorMSG=this->GenerateErrorMSG(QString::fromStdString(errstr));
emit this->TriggerState(this->TriggerName,-1);
}
dhCheck( dhGetObject(L"winmgmts:{impersonationLevel=impersonate,(Security)}!\\\\.\\root\\cimv2",NULL, &wmiSvc) );
Форум Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)