Nanja Raje Urs

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




Re: Media Foundation Development Problem in Monitor Control API's in Vista

Mike Wasson-MSFT

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.






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Nanja Raje Urs

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






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Mike Wasson-MSFT

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.






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Nanja Raje Urs

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






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Mike Wasson-MSFT

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.






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Nanja Raje Urs

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






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Mike Wasson-MSFT

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.






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Nanja Raje Urs

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






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Mike Wasson-MSFT

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.






Re: Media Foundation Development Problem in Monitor Control API's in Vista

Dragos Avadanei - MSFT

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





Re: Media Foundation Development Problem in Monitor Control API's in Vista

vic_ch2000

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);
}

}





Re: Media Foundation Development Problem in Monitor Control API's in Vista

Dragos Avadanei - MSFT

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





Re: Media Foundation Development Problem in Monitor Control API's in Vista

vic_ch2000

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





Re: Media Foundation Development Problem in Monitor Control API's in Vista

vic_ch2000

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.