Article View: borland.public.cppbuilder.nativeapi
Article #7926Re: ChangeDisplaySettingsEx driving me nuts...
From: Graham Thompson
Date: Thu, 16 Dec 2004 07:55
Date: Thu, 16 Dec 2004 07:55
40 lines
2554 bytes
2554 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:41c07e5c$1@newsgroups.borland.com...
> > when I go to call ChangeDisplaySettingsEx I get an access violation.
>
> Please show your actual code. An AV is caused by accessing invalid
memory.
8-)
OK, I've corrected a big DOH in the initialisation of my app, and I'm no
longer getting the AV. The original problem remains, though; no 'detaching'
of the monitor. MSDN states "To detach the monitor, set DEVMODE.dmFields to
DM_POSITION but set DEVMODE.dmPelsWidth and DEVMODE.dmPelsHeight to zero.",
but that's not what I'm getting. Here's the code:
DEVMODE dm;
dm.dmSize = sizeof(DEVMODE);
if (0 != EnumDisplaySettings(FMonitorInfo.DeviceName,
ENUM_CURRENT_SETTINGS,
&dm))
{
dm.dmFields = DM_POSITION;
dm.dmPelsWidth = 0;
dm.dmPelsHeight = 0;
LONG lResult = ChangeDisplaySettingsEx(FMonitorInfo.szDevice,
&dm,
NULL,
0,
NULL);
...
and lResult is coming back as DISP_CHANGE_SUCCESSFUL. But, the monitor is
still at the same position and certainly not 'detached'. (BTW, FMonitorInfo
is a copy of the DISPLAY_DEVICE result of an earlier call to
EnumDisplayDevices for the monitor.)
Thanks again for any advice...
Technical Details
Message-ID:
<41c13f6a@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41c00d82@newsgroups.borland.com> <41c07e5c$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4bfd89b1b8a413a2 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Graham Thompson" <gct@faGUESS-WHAT-TO-DO-WITH-THISsl.co.uk> Newsgroups: borland.public.cppbuilder.nativeapi References: <41c00d82@newsgroups.borland.com> <41c07e5c$1@newsgroups.borland.com> Subject: Re: ChangeDisplaySettingsEx driving me nuts... Date: Thu, 16 Dec 2004 07:55:24 -0000 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 62.173.124.106 Message-ID: <41c13f6a@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1103183722 62.173.124.106 (15 Dec 2004 23:55:22 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail