Board index » cppbuilder » Multi Monitor problem

Multi Monitor problem


2004-01-29 08:13:34 PM
cppbuilder107
Not strictly a BCB issue but you are all so clever. I use multiple monitors
which are NOT attached to the desktop. I use the WIN32 API's to drive them
and all is well... except... whenever I reboot, XP insists on making the
additional displays part of the desktop. I have to go to the Display
Settings and edit it manually to remove them from the desktop before running
my app. This is unacceptable sine the system must be capable of re-boot
without manual intervention. Can anyone advise how to get round this,
either by ensuring the OD honours my display settings, or through an API
call that allows me to detatch them from the desktop when the app starts ??
Many thanks,
Denville.
PS: OS is XP Pro. Tried several cards, same result. Tried with 'native' XP
drivers and with manufacturer's drivers. Tried on two quite different PC's
with different card combinations. Looks like an OS issue rather than a
driver issue.
 
 

Re:Multi Monitor problem

Not to worry, I've fixed it.
"Denville Longhurst" < XXXX@XXXXX.COM >wrote in message
Quote
Not strictly a BCB issue but you are all so clever. I use multiple
monitors
which are NOT attached to the desktop. I use the WIN32 API's to drive
them
and all is well... except... whenever I reboot, XP insists on making the
additional displays part of the desktop. I have to go to the Display
Settings and edit it manually to remove them from the desktop before
running
my app. This is unacceptable sine the system must be capable of re-boot
without manual intervention. Can anyone advise how to get round this,
either by ensuring the OD honours my display settings, or through an API
call that allows me to detatch them from the desktop when the app starts
??

Many thanks,
Denville.

PS: OS is XP Pro. Tried several cards, same result. Tried with 'native'
XP
drivers and with manufacturer's drivers. Tried on two quite different
PC's
with different card combinations. Looks like an OS issue rather than a
driver issue.


 

Re:Multi Monitor problem

Denville Longhurst wrote:
Quote
Not to worry, I've fixed it.
It would be nice if you gave the clue.
Hans.
 

{smallsort}

Re:Multi Monitor problem

Sorry, I thought no-one was interested!
This took a lot of sorting...
When you use CreateDisplayDC(..) to get a DC for an unattached display, you
pass a mode description which allows the OS to set up the display for you.
Somewhere since I developed the application XP has changed and now saves the
display parameters associated with your mode to the registry. When next you
boot up, the OS thinks it has to set up the display and make it part of the
desktop. This happens despite calling DeleteDC() to relinquish the display
on app exit.
I was certain that I needed to intervene and claim back to display from the
desktop but, despite examining ChangeDisplaySettingsEx several times I found
no reference to its ability to attach or detach a display. Having trawled
MSDN many times for a clue, I stumbled across the correct query key words
and found a Win98 article explaining how to use ChangeDisplaySettingsEx() to
attach/detach a display. To attach, you simply change to the settings you
want, to detach, you simply zero out the settings. This has fixed my
problem as I can now capture an incorrectly attached display when my app
starts up, but better, by clearing the parameters on exit, after I have
deleted the DC, the problem goes away altogether.
This is the exact code I use:
int Detach()
///////////
{
DEVMODE devmode ;
memset( &devmode, 0, sizeof(DEVMODE) ) ;
devmode.dmSize = sizeof(DEVMODE) ;
devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL
| DM_POSITION | DM_DISPLAYFREQUENCY | DM_DISPLAYFLAGS ;
return ChangeDisplaySettingsEx( cDeviceName, &devmode, NULL,
CDS_UPDATEREGISTRY, NULL ) ;
}
"Hans Galema" < XXXX@XXXXX.COM >wrote in message
Quote
Denville Longhurst wrote:

>Not to worry, I've fixed it.

It would be nice if you gave the clue.

Hans.
 

Re:Multi Monitor problem

Denville Longhurst wrote:
Quote
Sorry, I thought no-one was interested!
Oh, many people read this and don't know the answer. I didn't
either. But I'm interested.
Quote
This took a lot of sorting...
This is the exact code I use:
Thanks for sharing your knowledge.
Hans.
 

Re:Multi Monitor problem

My pleasure - next time I'll know.
Denville
"Hans Galema" < XXXX@XXXXX.COM >wrote in message
Quote
Denville Longhurst wrote:

>Sorry, I thought no-one was interested!

Oh, many people read this and don't know the answer. I didn't
either. But I'm interested.

>This took a lot of sorting...

>This is the exact code I use:

Thanks for sharing your knowledge.

Hans.