2025-05-12 22:59:41

清理和关闭 WMI 应用程序 - Win32 apps

退出应用程序。

下面的代码示例演示如何退出 WMI 客户端应用程序。

// The following #include and #define statements need

// to be used with this code:

// #define _WIN32_DCOM

// #include

// #pragma comment(lib, "wbemuuid.lib")

// pSvc was declared as IWbemServices *pSvc;

// pLoc was declared as IWbemLocator *pLoc;

pSvc->Release();

pLoc->Release();

CoUninitialize();

return 0; // Program successfully completed.

注意

变量 pSvc 的类型为 IWbemServices*,pLoc 变量的类型为 IWbemLocator*。