🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7917

Re: ChangeDisplaySettingsEx driving me nuts...

#7917
From: Bob Gonder
Date: Wed, 15 Dec 2004 16:55
27 lines
2200 bytes
Graham Thompson wrote:

>I'm developing in Windows XP using BCB5, and I'm trying to disable the
>secondary monitor in a two-monitor setup.
>
>Trawling through the MSDN it looks like ChangeDisplaySettingsEx is a good
>place to start ... I've enumerated my DisplayDevices like a good boy, but
>when I go to call ChangeDisplaySettingsEx I get an access violation.

You'll need to show the code. Just the bare minimum, please. But do
include the enum as the docs suggest using the devmode from the enum.

> Is ChangeDisplaySettingsEx part of GDI+? If os, should I be initialising GDI+
>with GdiplusStartup() before calling ChangeDisplaySettingsEx?

Looks like the + stuff are C++ objects, and you don't seem to be using
objects here.

>BTW (or should that be WTF): if I declare a spare DEVMODE struct in the
>function that calls ChangeDisplaySettingsEx, I don't get an access
>violation; the function succeeds but sets 'inappropriate' values.

A "spare" structure?

DEVMODE problems are sometimes fixed by adding
#define _WIN32_WINNT 0x0400
before any other #includes
Technical Details
Message-ID: <pdq0s0loofpvmc2kbjig9hgotqted750h4@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.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
References: <41c00d82@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: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: ChangeDisplaySettingsEx driving me nuts...
Date: Wed, 15 Dec 2004 08:55:20 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <pdq0s0loofpvmc2kbjig9hgotqted750h4@4ax.com>
References: <41c00d82@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.147.211
X-Trace: newsgroups.borland.com 1103129717 67.77.147.211 (15 Dec 2004 08:55:17 -0800)
Lines: 29
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.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