BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

video mode/pixel format

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
C. Bond
Guest





PostPosted: Fri Oct 03, 2003 2:15 am    Post subject: video mode/pixel format Reply with quote



How can I determine the desktop video mode/pixel format of the system
when my application starts?


--
Democracy: The triumph of popularity over principle.
--
http://www.crbond.com


Back to top
Wim Bekker
Guest





PostPosted: Fri Oct 03, 2003 2:41 pm    Post subject: Re: video mode/pixel format Reply with quote



Use VCL:

ScreenWidth=Screen().Width;
ScreenHeight=Screen().Height;

Or use NativeAPI:

HDC hdc=GetDC(NULL);
ScreenWidth=GetDeviceCaps(hdc,HORZRES);
ScreenHeight=GetDeviceCaps(hdc,VERTRES);

Wim

"C. Bond" <cbond (AT) ix (DOT) netcom.com> schreef in bericht
news:3F7CDBCF.3565CCC8 (AT) ix (DOT) netcom.com...
Quote:
How can I determine the desktop video mode/pixel format of the system
when my application starts?


--
Democracy: The triumph of popularity over principle.
--
http://www.crbond.com





Back to top
C. Bond
Guest





PostPosted: Fri Oct 03, 2003 4:01 pm    Post subject: Re: video mode/pixel format Reply with quote



Wim Bekker wrote:

Quote:
Use VCL:

ScreenWidth=Screen().Width;
ScreenHeight=Screen().Height;

Or use NativeAPI:

HDC hdc=GetDC(NULL);
ScreenWidth=GetDeviceCaps(hdc,HORZRES);
ScreenHeight=GetDeviceCaps(hdc,VERTRES);

Wim

"C. Bond" <cbond (AT) ix (DOT) netcom.com> schreef in bericht
news:3F7CDBCF.3565CCC8 (AT) ix (DOT) netcom.com...
How can I determine the desktop video mode/pixel format of the system
when my application starts?

Well, I can use "Screen" to get the height and width, but how do I get the
video mode and pixel format?

--
There are two things you must never attempt to prove: the unprovable -- and
the obvious.
--
Democracy: The triumph of popularity over principle.
--
http://www.crbond.com



Back to top
Wim Bekker
Guest





PostPosted: Mon Oct 06, 2003 10:33 am    Post subject: Re: video mode/pixel format Reply with quote

As far as I know, the 'video mode' isn't just a single value. Every
VideoMode is build up in a TDevMode struct (_devicemodeA).

To get the current VideoMode, you first have to EnumDisplaySettings and
store all results (where DevMode.dmDisplayFrequence>1) in a TDevMode list.
Then you need the BITSPIXEL, HORZRES, VERTRES and VREFRESH values from
GetDeviceCaps, and compare them to the items in the TDevModeList. When
there's match, you've found the current VideoMode (the entry in the
TDevModeList).

BITSPIXEL gives you the pixelformat but you have to interpret it to use it.

You can use the entries in the TDevModeList to change the DisplaySettings
(and use NULL to get the default DisplaySettings).

Wim


"C. Bond" <cbond (AT) ix (DOT) netcom.com> schreef in bericht
news:3F7D9D63.EFC5ABED (AT) ix (DOT) netcom.com...
Quote:
Wim Bekker wrote:

Use VCL:

ScreenWidth=Screen().Width;
ScreenHeight=Screen().Height;

Or use NativeAPI:

HDC hdc=GetDC(NULL);
ScreenWidth=GetDeviceCaps(hdc,HORZRES);
ScreenHeight=GetDeviceCaps(hdc,VERTRES);

Wim

"C. Bond" <cbond (AT) ix (DOT) netcom.com> schreef in bericht
news:3F7CDBCF.3565CCC8 (AT) ix (DOT) netcom.com...
How can I determine the desktop video mode/pixel format of the system
when my application starts?

Well, I can use "Screen" to get the height and width, but how do I get the
video mode and pixel format?

--
There are two things you must never attempt to prove: the unprovable --
and
the obvious.
--
Democracy: The triumph of popularity over principle.
--
http://www.crbond.com





Back to top
C. Bond
Guest





PostPosted: Mon Oct 06, 2003 5:36 pm    Post subject: Re: video mode/pixel format Reply with quote

Wim Bekker wrote:

Quote:
As far as I know, the 'video mode' isn't just a single value. Every
VideoMode is build up in a TDevMode struct (_devicemodeA).

To get the current VideoMode, you first have to EnumDisplaySettings and
store all results (where DevMode.dmDisplayFrequence>1) in a TDevMode list.
Then you need the BITSPIXEL, HORZRES, VERTRES and VREFRESH values from
GetDeviceCaps, and compare them to the items in the TDevModeList. When
there's match, you've found the current VideoMode (the entry in the
TDevModeList).

BITSPIXEL gives you the pixelformat but you have to interpret it to use it.

You can use the entries in the TDevModeList to change the DisplaySettings
(and use NULL to get the default DisplaySettings).

Wim

Thanks for the detailed answer. It does seem strange, though, that you can set
the video mode from the desktop, but cannot just read it directly somewhere.
--
Democracy: The triumph of popularity over principle.
--
http://www.crbond.com



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.