#### Archived

This topic is now archived and is closed to further replies.

# Getting the monitor information from Win Registry

This topic is 5639 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have Win2k and this is what basic detective work has given me: Win2k stores monitor information under the key
HKEY_LOCAL_MACHINE/System/ControlSet001/Enum/DISPLAY/
. I personally have three more keys under that one: Default_Monitor, nvWin2kDualView (which I presume is a Detonator thing since my graphics card doesn''t support dual view) and VSC5A44 (which I think is the real monitor driver key). These three keys are also duplicated under ControlSet002 and CurrentControlSet. Now, whereas the video driver key is uniquely referenced from a certain key, the monitor driver key isn''t which raises the following question: where should I look to find the currently active monitor information? CurrentControlSet seems like a reasonable place to start with for the root key. As for the subkeys, there can be any number of them (for instance if you have more than one monitor installed). Quick checking shows that the correct monitor information can be found in places marked as bold:
HKEY_LOCAL_MACHINE/System/ControlSet001/Enum/DISPLAY/
.../ControlSet002/...
.../CurrentControlSet/...
+ Default_Monitor
+ 5&30377192&0&11223344&01&05
+ 5&30377192&1&11223344&01&05
+ nvWin2kDualView
+ 5&30377192&0&c9000001&01&05
+ 5&30377192&1&c9000001&01&05
+ VSC5A44
+ 5&30377192&1&22446688&01&05

I have no idea how to decide that these are the places I should read to find out the proper monitor information... Anybody got any experience with this? Furthermore, I''m currently aiming at getting this thing to work on NT - is the registry structure the same on WinXP? I know pertty much for a fact that non-NT has it all messed up (or NT has it all messed up, depends on how you look at it)... Cheers

##### Share on other sites
i wouldn''t read such things from the registry directly, i''m pretty sure there''s a Win API function for retrieving monitor info/settings which will work with different windows versions. i don''t know the name of these functions though, but you should find it in the MSDN.

##### Share on other sites
1. Detailed monitor info is usually only available if monitor drivers have been installed.

2. Some info about the output comes from the display adapter drivers.

3. I agree with AP here. You shouldn''t be trying to get this stuff from the registry. The location might change between operating systems, and since there are Win32 API calls to get this stuff, MS will assume they can move the location/names of the registry keys so your app will break.

4. An example of some of the functions available to you (if you''re limiting yourself to NT, remember to check the compatibility section for the functions on MSDN):

EnumDisplayMonitors()
GetMonitorInfo()
MonitorFromWindow()
EnumDisplayDevices()
DeviceCapabilities()
GetDeviceCaps()
etc

You can also get some info through DirectX (NT supports DX3)

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

##### Share on other sites
quote:
Original post by Anonymous Poster
i wouldn''t read such things from the registry directly, i''m pretty sure there''s a Win API function for retrieving monitor info/settings which will work with different windows versions. i don''t know the name of these functions though, but you should find it in the MSDN.

I have pretty much exhausted MSDN on that part. Any structures with the word "monitor" in them contain information on printers, but not the display monitor.

PS - there doesn''t exist an official way to find out a lot of stuff related to your computer (information that exists in the registry). In Windows, the registry is about the most reliable source of information because that''s the information Windows itself is using.

##### Share on other sites
quote:
Original post by S1CA
EnumDisplayMonitors()
GetMonitorInfo()
MonitorFromWindow()
EnumDisplayDevices()
DeviceCapabilities()
GetDeviceCaps()
etc

EnumDisplayDevices()
MSDN/compiler docs: The EnumDesktopWindows function enumerates all windows in a desktop by passing the handle of each window, in turn, to an application-defined callback function.

DeviceCapabilities()
MSDN/compiler docs: The DeviceCapabilities function retrieves the capabilities of a printer device driver.

GetDeviceCaps()
Doesn''t return the information I want.

EnumDisplayMonitors()
GetMonitorInfo()
MonitorFromWindow()

My compiler doesn''t even recognize these function calls (hence, I didn''t know them) - will check them out on MSDN promptly.

quote:

You can also get some info through DirectX (NT supports DX3)

Sorry, not an option in this case.

##### Share on other sites
quote:
Original post by Crispy
EnumDisplayDevices()
MSDN/compiler docs: The EnumDesktopWindows function enumerates all windows in a desktop by passing the handle of each window, in turn, to an application-defined callback function.

EnumDesktopWindows() != EnumDisplayDevices().

##### Share on other sites
quote:
Original post by Dave Hunt
EnumDesktopWindows() != EnumDisplayDevices().

My mistake - copy-paste is to be blamed

It was a bit of a hack to get EnumDisplayDevices() and EnumDisplayMonitors() working on my BC5.02 since there apparently isn't a library that is supplied along with multimon.h. Fortunately BC5.5 has one

Anyway, neither GetMonitorInfo() nor EnumDisplayDevices() gave me what I want. EnumDisplayDevices() returns the actual driver (device) info requested. GetMonitorInfo() returns something like "\\.\DISPLAY1" for my one and only monitor. What I want is the monitor model string (ViewSonic PF775 in my case).

Never mind - I got it

[edited by - crispy on July 3, 2003 4:44:06 PM]

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633660
• Total Posts
3013221
×