Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WMI Put operation

WMI Put operation

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nonameseemstowork
    wrote on last edited by
    #1

    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

    X 1 Reply Last reply
    0
    • N nonameseemstowork

      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

      X Offline
      X Offline
      Xing Chen
      wrote on last edited by
      #2

      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[^]

      N 1 Reply Last reply
      0
      • X Xing Chen

        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[^]

        N Offline
        N Offline
        nonameseemstowork
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups