locked
Problem in Monitor Control API's in Vista RRS feed

  • Question

  • I have ATI card on my VISTA system, I want to control the monitor parameters using Monitor configuration functions.

    As a result in my appilcation I have loaded the dll,

    like LoadLibrary ("dxva2.dll")

    I also get the proc address of following functions

     GetNumberOfPhysicalMonitorsFromHMONITOR = (tGetNumberOfPhysicalMonitorsFromHMONITOR) GetProcAddress (hModule, "GetNumberOfPhysicalMonitorsFromHMONITOR");

     GetPhysicalMonitorsFromHMONITOR = (tGetPhysicalMonitorsFromHMONITOR) GetProcAddress(hModule, "GetPhysicalMonitorsFromHMONITOR");

     GetCapabilitiesStringLength = (tGetCapabilitiesStringLength) GetProcAddress(hModule, "GetCapabilitiesStringLength");

    When I try to use these function, following function works fine and returns necessary data

    1. GetNumberOfPhysicalMonitorsFromHMONITOR

    2. GetPhysicalMonitorsFromHMONITOR

    but when I call GetCapabilitiesStringLength() function, I always get the error

    ERROR_NOT_SUPPORTED.

    I wanted to know whether this is function has been implemented or not inside dxva2.dll?

    If not, how can I get the Capability String of the monitor?

    please reply me ASAP

    Urs

    Tuesday, February 6, 2007 12:11 PM

Answers

  • In that case, it seems the monitor you're using does not support DDC/CI.

    Due to various causes, the Monitor Config WDK tests are currently suspended, which means that even logo certified monitors may not support Monitor Config API correctly. I am sorry for the trouble you're encountering, perhaps you can try a different monitor? Without wanting to make any discriminations, we've noticed (in our testing), that NEC monitors are usually very reliable from this point of view.

    Dragos Avadanei, Video Infrastructure

    Wednesday, February 28, 2007 8:11 AM

All replies

  • ERROR_NOT_SUPPORTED means that your monitor does not support DDC/CI. The MonitorConfiguration API requires the monitor to support DDC/CI.

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2007 Microsoft Corporation. All rights reserved.

     

    Tuesday, February 6, 2007 6:58 PM
  • Dear Mike Wasson

      Thanks for your kind response, I think I should clarify follwoing things

    1. Our Monitor support DDC/CI, B'coz our applciation works fine on Windows XP with same monitor

    2. Also function like GetNumberOfPhysicalMonitorsFromHMONITOR, GetPhysicalMonitorsFromHMONITOR and DestroyPhysicalMonitors works fine and returns success.

    3. But Functions GetCapabilitiesStringLength, GetMonitorBrightness fails with error code ERROR_NOT_SUPPORTED

    My doubt is since all the functions belong to same DLL, dxva2.dll, why some functions returns success and while other send

    ERROR_NOT_SUPPORTED

    Thanks

    Urs

     

    Wednesday, February 7, 2007 5:53 AM
  • 1. The Monitor Configuration functions require Vista.

    2. The monitor enumeration functions (GetPhysicalMonitors, etc) do not depend on DDC/CI, so these will work even if the monitor is not DDC/CI compliant.

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2007 Microsoft Corporation. All rights reserved.

    Wednesday, February 7, 2007 7:28 PM
  •  Mike

     Thanks again, please find my replies to your points

    1. The error which we are getting is on Windows Vista platform

    2. We are fully aware of these things.

    Thanks

    Urs

     

     

     

    Thursday, February 8, 2007 5:05 AM
  • Another thought: These functions also require a WDDM (formerly "LDDM") display driver.

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2007 Microsoft Corporation. All rights reserved.

    Thursday, February 8, 2007 7:36 PM
  • Thanks Mike

         We updated the driver for NVidia card on VIsta OS, it's working.

         But on other system with ATI Raedon X1600 adapter, we updated the Vista driver for ATI Raedon X1600

         we are still facing the same problem like

     1. GetCapabilitiesStringLength() still fails, but this time the error code is out of range

    Thanks again

    Urs

       

     

    Friday, February 9, 2007 12:19 PM
  • I'm not sure which error code this is.

     

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2007 Microsoft Corporation. All rights reserved.

    Thursday, February 15, 2007 7:29 PM
  • In continuation with my earlier posts, I would like to add some more clarity into the problem

    1. ATI Raedon adapter(AGP) on Vista OS  returns successfully  GetCapabilitiesStringLength

    2. But ATI Raedon adapter (PCI Express) on Vista OS always fails GetCapabilitiesStringLength

    I really dont understand whatz exactly the problem, please throw some light on this issue, I'm stuck

    Since this function is failing I'm unable to get Capability String.

    Thanks again

    Urs

    Tuesday, February 20, 2007 11:24 AM
  • Sorry, I don't have any other ideas. It's probably one of:

    - Display driver is not WDDM

    - Monitor does not support DDC/CI

    - Monitor supports DDC/CI, but responded to the GetCapabilitiesStringLength request in a non-standard way. (Special case of #2, I guess).

     

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2007 Microsoft Corporation. All rights reserved.

    Friday, February 23, 2007 8:23 PM
  • Hello,

    You indicated earlier that updating the Nvidia driver resulted in a successful call to GetCapabilitiesStringLength, correct? You also mentioned that an ATi AGP card/driver that you have completed the call successfully, while this still failed in the PCIe configuration.

    From this, the issue appears to be exclusively a driver one. ERROR_NOT_SUPPORTED is usually returned by a driver that does not allow the creation of the object required by the Monitor Configuration API. If you are seeing a different error code, please post it here so that we may assist you further.

    Dragos Avadanei, Video Infrastructure

     

    Friday, February 23, 2007 9:32 PM
  • Hi all!

    I saw that DDC/CI API is common problem. But as I understood from previous post it's partially worked for other developers. My problem is worst because canonical MSDN sample doesn't work fo me (used ATI Radeon 600/GeForce 6600 PCI-E videocards with ACER 1951/Benq-71E+ displays. Vista Ultimate/Core Duo 6600/2 Gb RAM. Compiled with VS 2005 SP1. Used WHDQL ATI and Nvidia drivers. Program always return NULL for physical monitor handle. Damn):

    Initialization DDC/CI
    ----------------------

     hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTOPRIMARY);

     // Get the number of physical monitors.
     cPhysicalMonitors = 0;
     BOOL bSuccess = GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, &cPhysicalMonitors);

     if (bSuccess)
     {
      // Allocate the array of PHYSICAL_MONITOR structures.
      pPhysicalMonitors = (LPPHYSICAL_MONITOR)malloc(cPhysicalMonitors* sizeof(PHYSICAL_MONITOR));
      if (pPhysicalMonitors != NULL)
      {
       // Get the array.
       bSuccess = GetPhysicalMonitorsFromHMONITOR(
        hMonitor, cPhysicalMonitors, pPhysicalMonitors);
      }
     }

     if (!bSuccess)
     {
      AfxMessageBox("Can't initialize DDC/CI!");
      return FALSE;
     }

     USES_CONVERSION;
     LPPHYSICAL_MONITOR pPhysicalMonitorTemp = pPhysicalMonitors;
     for (int i = 0; i < cPhysicalMonitors; i++)
     {
      msg.Format("%s", W2A(pPhysicalMonitorTemp->szPhysicalMonitorDescription));
      this->m_cbDisplay.AddString(msg);
      pPhysicalMonitorTemp++;
     }
     cCurrentMonitor = 0;
     if (cPhysicalMonitors) this->m_cbDisplay.SetCurSel(cCurrentMonitor);

     InitializeBrightness();
     DWORD len = 0;
     if (GetCapabilitiesStringLength(h, &len))
     {
      char buffer[65535];
      memset(buffer, 0, sizeof(buffer));
      CapabilitiesRequestAndCapabilitiesReply(h, buffer, len);
     }

    ......

    Query brightness
    ----------------
    void CVistaDDCDlg::InitializeBrightness()
    {
     // LPPHYSICAL_MONITOR pPhysicalMonitorTemp = &pPhysicalMonitors[cCurrentMonitor];
     DWORD dwMin = 0, dwMax = 0, dwTemp = 0, found = 0;
     DWORD dwMonitorCapabilities = 0, dwSupportedColorTemperatures = 0; //hMonitor
     HANDLE h = pPhysicalMonitors[cCurrentMonitor].hPhysicalMonitor; // hMonitor;
     DWORD rc;

     if (h == NULL)
     {
      AfxMessageBox("Handle to physical monitor is NULL!");
     }

     BOOL ret = GetMonitorCapabilities(h, &dwMonitorCapabilities, &dwSupportedColorTemperatures);
     if (ret)
     {
      if (dwMonitorCapabilities & MC_CAPS_BRIGHTNESS)
      {
       if (GetMonitorBrightness(h, &dwMin, &dwMax, &dwTemp))
       {
        m_csBrigtness.SetRange(dwMin, dwMax);
        m_csBrigtness.SetPos(dwTemp);
        found = 1;
       }
      }
     }
     else
     {
      rc = GetLastError();
     }
     if (!found)
     {
      m_csBrigtness.EnableWindow(FALSE);
      AfxMessageBox("Couldn't reading capabilities string!");
     }

     DWORD len = 0;

     if (GetCapabilitiesStringLength(h, &len))
     {
      char buffer[65535];
      memset(buffer, 0, sizeof(buffer));
      CapabilitiesRequestAndCapabilitiesReply(h, buffer, len);
     }

    }

     

    Tuesday, February 27, 2007 3:06 AM
  • I assume you validated the monitor handle returned by MonitorFromWindow? Can you try this code again, substituting MonitorFromWindow with EnumDisplayMonitors?

    If the monitor handle appears to be valid and the physical monitor handle is still null, kindly please call GetLastError following the failed GetPhysical* call(s) and post here the error codes.

    Regards,

    Dragos Avadanei, Video Infrastructure

    Wednesday, February 28, 2007 12:18 AM
  • Thanks for fast answer. I tried with EnumDisplayMonitors too. Result was the same (success).

    Display name filled but monitor handle was equal null. It's memory dump for structure:

    -  pPhysicalMonitors 0x00348630 {hPhysicalMonitor=0x00000000 szPhysicalMonitorDescription=0x00348634 "Generic PnP Monitor" } _PHYSICAL_MONITOR *

    String with monitor description changed when I used monitor-specific driver. But hPhysicalMonitor was NULL always. Because

    GetLastError() after call GetCapabilitiesStringLength 3223725441. But IMHO it is trash because NULL handle.

    I'll try to use previous author idea about dynamic linkage from dll. I'll write about results later. I'll post full sources if requires to any public site.

    Regards

    Vic

    Wednesday, February 28, 2007 2:35 AM
  • I added error handling for my program:

    no device on the I2C bus has the specified address

    after GetCapabilitiesStringLength call

    I tested program with Asus P5LD2 (Intel 945G chipset) and GeForce6600

    I'll send results for Intel 915P chipset with Radeon-X600Pro after 2 hours.

     

    Wednesday, February 28, 2007 7:54 AM
  • In that case, it seems the monitor you're using does not support DDC/CI.

    Due to various causes, the Monitor Config WDK tests are currently suspended, which means that even logo certified monitors may not support Monitor Config API correctly. I am sorry for the trouble you're encountering, perhaps you can try a different monitor? Without wanting to make any discriminations, we've noticed (in our testing), that NEC monitors are usually very reliable from this point of view.

    Dragos Avadanei, Video Infrastructure

    Wednesday, February 28, 2007 8:11 AM
  • I tested it with Radeon X600Pro+Benq-FP71E+.

    Result was dicouraged:

    "A device attached to the system is not functionig."

    I read your last message and decided try with ancient NEC 92VM

    Wow - it's work :-)

    Great thanks!

    Vic

    Wednesday, February 28, 2007 9:53 AM
  • Thanks Guys for you support. I'm facing new problem

    On Vista OS with nVIDIA adapter (necessary driver installed) and two monitors connected

    1st Monitor is DDC/CI compliant

    2nd Monitor is non DDC/CI, connected in extended mode of display serttings

    I have written a sample code as below

    Code Start

    HMONITOR hMonitor = MonitorFromWindow (m_Hwnd, MONITOR_DEFAULTTOPRIMARY);
    if (hMonitor == NULL)
    {  
           LOG_DM_MESSAGE_HIGH("CVistaAdapter::EnumerateDevices: MonitorFromWindow failed");
           RETURN_DM_ERROR(eMONERR_DM_ENUM_NO_DISPLAY_FOUND);
    }

     bSuccess = GetNumberOfPhysicalMonitorsFromHMONITOR (hMonitor,  &dwMonitorCount);   
     if(0 == dwMonitorCount)
     {
                LOG_DM_MESSAGE_HIGH("CVistaAdapter::EnumerateDevices: dwMonitorCount is 0");
     }

    Here I always get dwMonitorCount = 1, even though I have connected 2 monitors.

    I even tried EnumDisplayMonitors, still GetNumberOfPhysicalMonitorsFromHMONITOR returns 1

    can anyone help me out

    thanks

    Urs

     

     

    Tuesday, March 6, 2007 4:49 AM
  • I am facing the same problem.

     

    In "Clone" mode, API will get 2 monitors.

    In "External only" mode, API will get 1 monitor (external one).

    In "Extended" mode, API will get 1 monitor (local one).

     

    Can I get both 2 handles in every mode ?

     

    Does anyone have any idea about this ?

     

    Thanks.

    Friday, May 16, 2008 2:26 AM
  • 1. GetNumberOfPhysicalMonitorsFromHMONITOR

    2. GetPhysicalMonitorsFromHMONITOR

    Above functions work fine, but when I call GetCapabilitiesStringLength() function, I always get the error:

    ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE ("This function failed because an invalid monitor handle was passed to it").


    I checked my monitor handle is non-NULL (0x10001).

    Can someone help, thanks!
    atif
    Wednesday, December 9, 2009 9:29 PM
  • 1. The Monitor Configuration functions require Vista.

    2. The monitor enumeration functions (GetPhysicalMonitors, etc) do not depend on DDC/CI, so these will work even if the monitor is not DDC/CI compliant.

    ----------------------------------------------------------------------------
    Mike Wasson, SDK Documentation
    This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

    (c) 2007 Microsoft Corporation. All rights reserved.


    Thanks for your message!
    Tuesday, January 25, 2011 10:01 AM