Craig Home
Mar 5th, 2001, 02:48 PM
Hello Steve,
I am trying to use your Enum Display routine with a "dual-head" card with not much success as it only seems to find the first monitor's resolution when the display is over 2,3 or even four screens. What I am trying to do is when an application starts is make a decision on how many monitors are available and intelligently position the forms.
I am using a Colorgraphic Predator LT4 card under Windows NT 4.0 and I have the C++ for getting it right but I am just about o.k at Visual Basic, never mind C++! :) (if it didn't have to run under NT4 I would be o.k. I think!)
Maybe you can help, maybe you can't but I have tried to convert the following to VB with no success :(
I have attached the C code anyway to see whether it will help you find out what is going wrong.
Thanks for any help you can give,
Regards,
Craig McConkey
// Structure for DriverEscape call to get VideoConfig
typedef struct _DISPLAYESCCONFIG
{
ULONG DesktopCX; // Desktop width
ULONG DesktopCY; // Dekstop height
ULONG ScreenCX; // Screen width
ULONG ScreenCY; // Screen height
ULONG xOverlap; // Amount of x Overlap per screen
ULONG yOverlap; // Amount of y overlap per screen
ULONG BPP; // Number of bytes per pixel 1, 2 or 3
ULONG HCount; // Number of displays horizontally
ULONG VCount; // Number of displays vertically
ULONG FSD; // Full screen display number
ULONG BOFS; // boolean for BlankOnFullScreen
ULONG Hz; // Vertical refresh rate
} DISPLAYESCCONFIG, *PDISPLAYESCCONFIG;
#define CCC_ESCAPE_GET_VIDEO_CONFIG 0xCCC+0
DISPLAYESCCONFIG DriverConfiguration;
RECT DisplayMap[64]={0};
int ScreenCount=0;
// Get the Screen info
BOOL WINAPI MapScreenInfo(void)
{
HDC hDCDisplay;
ULONG pvIn;
// New style check
if (hDCDisplay = CreateDC("DISPLAY", NULL, NULL, NULL))
{
pvIn = CCC_ESCAPE_GET_VIDEO_CONFIG;
if (ExtEscape(hDCDisplay, QUERYESCSUPPORT, sizeof(ULONG), (LPVOID)
&pvIn, 0, NULL))
{
if (ExtEscape(hDCDisplay, CCC_ESCAPE_GET_VIDEO_CONFIG, 0,
(LPVOID) NULL, sizeof(DISPLAYESCCONFIG), (LPSTR) &DriverConfiguration))
{
// Here we build a map of the video configuration
// ScreenCount is the number screens
ScreenCount = DriverConfiguration.HCount *
DriverConfiguration.VCount;
// Setup rectangle for each screen
for (V=0; V < (LONG) DriverConfiguration.VCount; V++)
{
for (H=0; H < (LONG) DriverConfiguration.HCount; H++)
{
S = (V * DriverConfiguration.HCount) + H;
// Setup our display map
DisplayMap[S].left = DriverConfiguration.ScreenCX *
H;
DisplayMap[S].right = DisplayMap[S].left +
DriverConfiguration.ScreenCX;
DisplayMap[S].top = DriverConfiguration.ScreenCY *
V;
DisplayMap[S].bottom = DisplayMap[S].top +
DriverConfiguration.ScreenCY;
}
}
DeleteDC(hDCDisplay);
return(TRUE);
}
}
DeleteDC(hDCDisplay);
}
return(FALSE);
}
I am trying to use your Enum Display routine with a "dual-head" card with not much success as it only seems to find the first monitor's resolution when the display is over 2,3 or even four screens. What I am trying to do is when an application starts is make a decision on how many monitors are available and intelligently position the forms.
I am using a Colorgraphic Predator LT4 card under Windows NT 4.0 and I have the C++ for getting it right but I am just about o.k at Visual Basic, never mind C++! :) (if it didn't have to run under NT4 I would be o.k. I think!)
Maybe you can help, maybe you can't but I have tried to convert the following to VB with no success :(
I have attached the C code anyway to see whether it will help you find out what is going wrong.
Thanks for any help you can give,
Regards,
Craig McConkey
// Structure for DriverEscape call to get VideoConfig
typedef struct _DISPLAYESCCONFIG
{
ULONG DesktopCX; // Desktop width
ULONG DesktopCY; // Dekstop height
ULONG ScreenCX; // Screen width
ULONG ScreenCY; // Screen height
ULONG xOverlap; // Amount of x Overlap per screen
ULONG yOverlap; // Amount of y overlap per screen
ULONG BPP; // Number of bytes per pixel 1, 2 or 3
ULONG HCount; // Number of displays horizontally
ULONG VCount; // Number of displays vertically
ULONG FSD; // Full screen display number
ULONG BOFS; // boolean for BlankOnFullScreen
ULONG Hz; // Vertical refresh rate
} DISPLAYESCCONFIG, *PDISPLAYESCCONFIG;
#define CCC_ESCAPE_GET_VIDEO_CONFIG 0xCCC+0
DISPLAYESCCONFIG DriverConfiguration;
RECT DisplayMap[64]={0};
int ScreenCount=0;
// Get the Screen info
BOOL WINAPI MapScreenInfo(void)
{
HDC hDCDisplay;
ULONG pvIn;
// New style check
if (hDCDisplay = CreateDC("DISPLAY", NULL, NULL, NULL))
{
pvIn = CCC_ESCAPE_GET_VIDEO_CONFIG;
if (ExtEscape(hDCDisplay, QUERYESCSUPPORT, sizeof(ULONG), (LPVOID)
&pvIn, 0, NULL))
{
if (ExtEscape(hDCDisplay, CCC_ESCAPE_GET_VIDEO_CONFIG, 0,
(LPVOID) NULL, sizeof(DISPLAYESCCONFIG), (LPSTR) &DriverConfiguration))
{
// Here we build a map of the video configuration
// ScreenCount is the number screens
ScreenCount = DriverConfiguration.HCount *
DriverConfiguration.VCount;
// Setup rectangle for each screen
for (V=0; V < (LONG) DriverConfiguration.VCount; V++)
{
for (H=0; H < (LONG) DriverConfiguration.HCount; H++)
{
S = (V * DriverConfiguration.HCount) + H;
// Setup our display map
DisplayMap[S].left = DriverConfiguration.ScreenCX *
H;
DisplayMap[S].right = DisplayMap[S].left +
DriverConfiguration.ScreenCX;
DisplayMap[S].top = DriverConfiguration.ScreenCY *
V;
DisplayMap[S].bottom = DisplayMap[S].top +
DriverConfiguration.ScreenCY;
}
}
DeleteDC(hDCDisplay);
return(TRUE);
}
}
DeleteDC(hDCDisplay);
}
return(FALSE);
}