Getting the max possible display rate of connected monitors - windows

I am trying to get programmatically the maximum display rate that Windows allows (i.e, Display settings > Advanced display settings > Refresh rate > max value). Chances are, there's no such query and I instead need to obtain all the possible options. How do I do that ?
I've already obtained the monitor names and current refresh rates using the CCD API, by obtaining DISPLAYCONFIG_PATH_INFOs and by using DisplayConfigGetDeviceInfo. But I can't seem to find a way to obtain the refresh rate options associated to a monitor. A CCD API based solution would be perfect, but an alternative is fine - it just means I'll have to reconcile the information obtained via the CCD API with that obtained from that other API, somehow.
Also, I'm trying to do this in the context of a plain Windows executable, that doesn't use a specific graphics backend library (ex DX12) or game-making framework.
Thanks !

Using the CCD API, you can use DisplayConfigGetDeviceInfo to get the GDI device name using DISPLAYCONFIG_DEVICE_INFO_TYPE::DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME , usually something like \\.\DISPLAY1, \\.\DISPLAY2, etc.
Once you have that device name, you can use the EnumDisplaySettingsW function to enumerate all DEVMODE for this device, this will give you all possible combination of modes (resolution, frequency, etc.) that the device supports (that can easily return hundreds of modes).
Once you have that you just need to group them by DEVMODE's dmDisplayFrequency field (and sort it).

Related

How do I get the DeviceName ("\\.\DISPLAY1") that corresponds to a PNPDeviceID ("SWD\MyEnumerator\MyInstance")?

To manage display adapters and display properties, my code uses APIs from two different Windows DLLs:
CfgMgr32.dll
I use functions in CfgMgr32 (successor to SetupApi) to:
enumerate adapters (get ids & properties)
determine whether a specific adapter exists
determine whether an adapter is enabled/disabled
enabled/disabled an adapter
register a callback to receive PnP device events
APIs in CfgMgr32 (and SetupApi) use an adapter id (called DeviceInstanceId or PNPDeviceID) of the form: "SWD\MyEnumerator\MyInstance"
User32.dll
I use functions in User32 to:
enumerate adapters (get ids & properties)
query an adapter's supported resolutions
query an adapter's current display mode
change an adapter's current orientation
change an adapter's current resolution
APIs in User32 uses use a completely different adapter id (called DeviceName) of the form: "\\.\DISPLAY23"
The (Astonishing) Problem:
There appears to be no documented way of mapping between these two forms of unique identifiers. I can enable an adapter, but when I want to change its orientation or resolution, I have no way of knowing which of the identifiers returned by EnumDisplayDevices(...) refers to the same adapter I just enabled.
The APIs I need are split across two libraries; neither library provides a complete set of display adapter management functions.
Both libraries have functions that let you get information about a particular adapter, and there is some minor overlap, but critically: nothing that's unique to a single adapter. Maybe there's some way to unambiguously relate properties from one side to the other, but I've dumped out everything that's available (including SystemInformation, Screen.AllScreens, Wmi queries like Win32_VideoController, DISPLAY_DEVICE...) and in all that information I can't find anything mappable.
Has anyone solved this, or know of some open source project that might be worth looking over?

Obtain GPS Coordinates from A3 Flight Controller using SDK

I am having a hard time finding any documentation on what I am trying to accomplish.
Basically, all I need to do is set up the A3 flight controller to output the GPS coordinates every defined interval through the local SBus port. When connected in Assistant 2, it looks like you can map the A3 output to a number of different functions, including SDK 1-8 which can be defined through code using the onboard SDK.
Here's where I am a bit confused, however. In the same software, if you click on the SDK tab, you can get to a window where you can define what is output, baud rates, etc..:
So my question is, when you define all the output frequencies and settings in the SDK tab, does this information automatically get output to all of the F5-F8 ports that are set to SDK? Basically, I am simply trying to obtain the coordinates so if there is a way to do it without writing code, this would be ideal.
Thank you in advance.
Based on some trial and error, I was able to determine that the parameters defined in the Data and Transmission Rates page are sent through the API port on the A3. After defining the desired frequency, I am able to get the position directly from this port without having to write any code. Hopefully this helps someone else that has the same question.

How to make directShow to Create graph automatically with available filters

I want to use the Medialooks multisource filter in my application, This has entry in
HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\
But still i have to Add this filter manually using CLS_ID and AddFilter Function.
Is there any way so that Renderfile function of Dshow will automatically creates a graph by enumerating the filters from registry
Checked in Grphedt tool but if i manually insert and connect Filters I can play the videos properly.Otherwise it wont render automatically by building the graph
Ability yo connect filters and obtain a topology of your interest is one thing, and having this sort of connection taking place during Intelligent Connect is another thing. For Intelligent Connect and RenderFile the filters of interest must be apparently registered, and then they have accurate DirectShow registration details: merit, media types. Quite so often filters are lacking this registration (and at other times they are "over-registrating" themselves so that they are picked up when they are obvious misfit).
Even though you can re-register filter yourself (see IFilterMapper2::RegisterFilter) with alternate registration details, you typically do not do it. It's filter developer's business to register accurately. The better alternative for you is to build graph using AddFilter calls where you have fine control over graph construction. Or you might want to do it as a fallback construction method if RenderFile fails in first place.

Cocoa API for Disk Space Usage Breakdown

I would like to be able to display a disk space usage breakdown chart similar to the one used in the System Information app built into Mac OS X (see image below). I've searched but have been unable to find an API which returns any detailed breakdown. The best I can find is the total disk space used.
As far as I can tell, the data in the screenshot (which actually looks incorrect in this example) is not calculated by sizing the default Music, Movies, Photos and Application folders. It does seem to add up the data used by specific file types.
Perhaps they are using the Metadata APIs and customizing the search a bit?
That's what I had used in the past to get a breakdown of certain types...
https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/Introduction.html

How to get CellTower-ID from GeoCoordinateWatcher

I have used this :
var watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
Where Hgh means GPS and Default is the result from any of these : GPS, WiFi
I like to know :
1) Is Default refering to CellTower ID or WIFI ? any different?
2) When I turn on my App running this Watcher inside the building ( not close to any entrance or window) , I can not get any result or no Signal at all from this watcher ?
If default refer to Wifi, it should be able to get the Cell_Tower ID .
If I am closer to the window or entrance of the building, I can get the result from Watcher.
Any1 can help me on this?
Thanks
The GeoPositionAccuracy does not directly refer to use of GPS or not.
The GeoPositionWatcher provides an abstraction layer to the way that the location is resolved internally. You will never know what was used to determine the location. Because the watcher does not indicate how the location was determined, it does not provide access to information based on a specific technology which may or may not have been used in identifying the device's location.
In theory, depending on the location of the device it may be possible to get a "High" accuracy reading based purely on public wifi data.
You cannot get the cell tower ID from any of the available APIs.

Resources