Post Reply

Forums -> Multiple monitors -> need help with setting primary monitor
korwin   2002-01-15 05:00
This may not be the correct forum, but it seems like the best spot I have found so far to post this question. I want to programatically switch display number 2 to be the primary display and also change the screen resolution temporarily to 640x480. This is what I am doing (I have VC5 and W2k):

DEVMODE devicemode;
devicemode.dmSize = sizeof(devicemode);

EnumDisplaySettings("\\\\.\\Display2", 0, &devicemode);

devicemode.dmPelsWidth = 640;
devicemode.dmPelsHeight = 480;
devicemode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;

ChangeDisplaySettingsEx("\\\\.\\Display2", &devicemode, NULL, CDS_SET_PRIMARY, NULL);


The problem is that although the screen resolution correctly changes to 640x480 I can not get my secondary display to become my primary display.

Anyone know if I am doing something wrong? Any ideas or hints? I am not even positive that my runtime library supports setting the primary display but the constants are in winuser.h so I assumed they were supported. Does anyone know what system .dll I need to support this?

thanks a lot,
korwin
Forums -> Multiple monitors -> need help with setting primary monitor

Post Reply