Introduction - If you have any usage issues, please Google them yourself
① initialize COM Interface: Access WMI, you must initialize the COM interface, the program started to call CoInitialize (NULL) initialization, call CoUninitialize at the end () releasing resources. Both functions# include <comdef.h> Inside definition. ② gain access WMI permissions: CoInitializeSecurity (NULL,-1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0) If this function returns S_OK obtain permission success, otherwise fail. ③ IWbemServices by IWbemLocator and two COM interfaces to access WMI, get system information: parameters of this function: lpList return information, wsClass class for the system to find information, and these COM interfaces in# include <wbemidl.h> In the definition.