PDA

View Full Version : Sorta OT, but EnumDisplayDevices question...



Siwko
03-30-2001, 10:53 AM
I'm working on making a setup/configurator for my app in order to be able to set which display device is used, what resolution and color depth (among other things) are to be used every time the app is run. Basically, this will configure the engine for OpenGL.

However, I have a problem. I'm trying to use EnumDisplayDevices to retrieve the what is connected to the system... but the compiler (MSVC6.0 with SP5) comes back on compile and says that EnumDisplayDevices is an undefined identifier. It is present in WinUser.h, and this is on Windows 2000. I can't get it to compile at all.

Any suggestions on what I should do here?

Siwko

n3r0nix
03-30-2001, 11:08 AM
found this in a the MSDN library "How to Exploit Multiple Monitor Support in Memphis and Windows NT 5.0"

when you include "multimon.h" EnumDisplayDevices is recognized but I don't know what to link it with so that it works

BwB
03-30-2001, 11:18 AM
I just did the same thing for my app. One thing that can do is "#define WIN_VER 0x500" (maybe its WINVER) before including windows, this compiles in the multi-monitor code, but it gives a message during compilation that says you shouldnt use that code with release products. I did that once before and it worked fine but when I tried it this last time it was giving me unresolved externals in the libs, so I just did the right thing and downloaded the Platform SDK from Microsoft. Havent had any problems since.
You can download a copy of the program I made at http://www.kyberteknik.com/DisplayModes.zip (it will be moving in the future, but its there a the time being). The version I have at home has support for saving the options to the registry but I've decided to go with a much simpler interface for my final utility. It does show off how to enumerate display modes, display adapters, and the display devices connected to the adapters.

n3r0nix
03-30-2001, 11:19 AM
found another piece of sample code, seems as if this is not implemented correctly because it won't compile on my computer.
http://support.microsoft.com/support/kb/articles/Q197/6/71.asp

Siwko
03-30-2001, 11:24 AM
Okay then... thanks...

I also don't know the linker dependancy on multimon.h, it returns an unresolved external (a little more helpful then an undefined id).

What I don't understand is that Win2K returns WINVER == 0x0500, so the one in WINUSER.H should work.

This is very confusing.

Are there any other ways to probe the card like this that work?

Siwko

Siwko
03-30-2001, 11:50 AM
Okay, I lied. It reports 0x0400.

Why?

Siwko
03-30-2001, 11:54 AM
Okay, Apparently EnumDisplayDevices is an extension that isn't the generic API (mostlikely because 95 and NT don't support multimon). You have to retrieve the procaddress.

Oh welll... you'd figure they'd do it right.

Siwko

n3r0nix
03-30-2001, 12:53 PM
why do you want do enumerate the devices?
It should be sufficient to only use the primary device and enumerate the device modes, except if you want multimonitor support.

BwB
03-30-2001, 07:43 PM
I did it simply for the experience. If you download the latest platform SDK (only about 20mb download) you get full support for the multimonitor stuff, you dont have to get a proc address or anything like that. But it is true that it will not work on win9x and winnt. They have some kind of stub workaround for that problem but I dont know how it works.

Siwko
03-31-2001, 04:14 AM
I want to enumerate devices in the case of multiple devices. For instance, a NVidia card as your primary and a Voodoo2 as your secondary, or perhaps a multimonitor setup that isn't DualHead off of one device (like I have at work - a GeForce and a 3Dlabs card).

You can't simply enumerate monitors in that case because each monitor is on a different device, and you need the device names to get the monitors.

Siwko