PDA

View Full Version : How to get second monitor's display size



ash
07-23-2009, 03:22 PM
How to get second monitor's display size? I used !display_size to get the primary monitors resolution how can I get the secondary in PV-Wave. I am using Windows XP and PV-Wave 8.0

Thanks
Ash

hcrisp
07-29-2009, 07:03 AM
Since nobody else has suggested it, let me mention that you could call regedit and parse the string output. You will have to convert the hex value to decimal.

The call will look like:



SPAWN, 'REG QUERY "HKCC\System\CurrentControlSet\Services" /S', result


Look for DefaultSettings.XResolution and DefaultSettings.YResolution.

ash
09-18-2009, 10:25 AM
I tried the registry way of getting the monitor resolution and that option only works for users who have admin rights in their PC and not for users with limited rights. So, I wrote a small dll in C which returns different information about the monitor resolution and used Linknload to access it.



// Set the windows operating system: Windows XP
#define WINVER 0x0501

// GetSystemMetrics is a function from Window.h
#include <Windows.h>

Pseudo code:

//Returns the total number of monitors
GetSystemMetrics( SM_CMONITORS )

//Returns the total resolution of the X-axis
GetSystemMetrics( SM_CXVIRTUALSCREEN )

//Returns the total resolution of the Y-axis
GetSystemMetrics( SM_CYVIRTUALSCREEN )

//Returns the Primary monitor's resolution of the X-axis
GetSystemMetrics( SM_CXSCREEN )

//Returns the Primary monitor's total resolution of the X-axis
GetSystemMetrics( SM_CYSCREEN )

ash
09-21-2009, 02:00 PM
http://msdn.microsoft.com/en-us/library/ms724385%28VS.85%29.aspx

Requirements

Minimum supported client
Windows 2000 Professional

Header
Winuser.h (include Windows.h)

Library
User32.lib

DLL
User32.dll