The following code is an example of receiving event notifications through WMI: #include "eventsink.h"int main(int iArgCnt, char ** argv){ HRESULT hres; // Step 1: -------------------------------------------------- // Initialize COM. ------------------------------------------ hres = CoInitializeEx(0, COINIT_MULTITHREADED); if (FAILED(hres)) { cout << "Failed to initialize COM library. Error code = 0x" << hex << hres
文章来源:
http://blog.csdn.net/mejy/archive/2008/01/17/2049064.aspx