WMI Put operation
-
I'm trying to set a parameter through WMI. I can read a value as follows: IEnumWbemClassObject* pEnumerator = NULL; hres = pSvc->ExecQuery( bstr_t("WQL"), bstr_t("SELECT * FROM CIM_VideoController"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); hr = pclsObj->Get(L"CurrentHorizontalResolution", 0, &vtProp, 0, 0); But when I try to do a set as follows: V_VT(&v) = VT_I4; V_I4(&v) = 1024; hr = pclsObj->Put(L"CurrentHorizontalResolution", 0, &v, VT_I4); I get an error return value of: 0x80041005 Any guidance woudd be appreciated! Jeremy
-
I'm trying to set a parameter through WMI. I can read a value as follows: IEnumWbemClassObject* pEnumerator = NULL; hres = pSvc->ExecQuery( bstr_t("WQL"), bstr_t("SELECT * FROM CIM_VideoController"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn); hr = pclsObj->Get(L"CurrentHorizontalResolution", 0, &vtProp, 0, 0); But when I try to do a set as follows: V_VT(&v) = VT_I4; V_I4(&v) = 1024; hr = pclsObj->Put(L"CurrentHorizontalResolution", 0, &v, VT_I4); I get an error return value of: 0x80041005 Any guidance woudd be appreciated! Jeremy
CIM_VideoController::CurrentHorizontalResolution
Data type: uint32 Access type: Read-only Current number of horizontal pixels.
so you can't set it by put method. you can see more info in MSDN: http://msdn2.microsoft.com/en-us/library/aa388668.aspx[^] -
CIM_VideoController::CurrentHorizontalResolution
Data type: uint32 Access type: Read-only Current number of horizontal pixels.
so you can't set it by put method. you can see more info in MSDN: http://msdn2.microsoft.com/en-us/library/aa388668.aspx[^]Thanks -- I should have noticed the access-type. So, it seems that this stunning complicated wmi interface is just to get stuff. So, back to ChangeDisplaySettings. I'll post another question on that!! Jeremy