[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Getting Monitors and Monitor Resolutions?



It's not necessarily a DirectX operation, per se.  These operations are
supported only in the Windows API version 5.0 or higher (basically Win98,
W2k, or newer).  <multimon.h> is provided by MS to get around this API
version issue.  At run-time the code basically checks to see if the API
calls exist, and if not some simple code "stubs" are used instead.

The basic job is to #include <multimon.h> in your .h file.  In your .cc
file, you can include something like:

#define COMPILE_MULTIMON_STUBS // compile stubs that conditionally
substitute for missing functions
#include<multimon.h>

You can then call the various functions defined in multimon.h.  I use these
calls in vw.h and vw.cc, but the latest version of these files are not on
the computer I'm presently typing on.

There is an easier way to get the number of monitors:
GetSystemMetrics(SM_CMONITORS).  You can get the size of the default monitor
through GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN), but
this won't help you with the other monitors.  Note that not all version of
Windows support these parameters to GetSystemMetrics().

MD

> -----Original Message-----
> From: owner-openmash-developers@bmrc.berkeley.edu
> [mailto:owner-openmash-developers@bmrc.berkeley.edu]On Behalf Of Wesley
> Miaw
> Sent: Wednesday, January 16, 2002 10:37 PM
> To: openmash-developers@openmash.org
> Subject: Getting Monitors and Monitor Resolutions?
>
>
> Does anyone know how to get from within Tk the number of monitors and
> resolutions/pixel offsets of those monitors? ag-vic seems to require
> DirectDraw C code to find out this information for multiple monitors. Is
> this the only way to do it? The DirectDraw code returns a list of
> coordinates, so the second monitor's coordinates might be something like
> 1024,0 to 2047,768 (placed to the right of the first/root monitor).
>
> Thanks,
> --
> Wesley Miaw, Assistant Systems Administrator
> Berkeley Multimedia Research Center
> wesley@bmrc.berkeley.edu
>