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 

Screen resolution

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





PostPosted: Wed Oct 29, 2003 10:13 am    Post subject: Screen resolution Reply with quote



Hi all,
i need to know if there is a way to change the screen resolution, setting it
to 800*600 when my program is started.
Don't know if it matter, but i'm using BCB 5 and Windows 2000 - XP.
Any help will be very appreciated !

Thanks, Marco


Back to top
Damon Chandler (TeamB)
Guest





PostPosted: Wed Oct 29, 2003 11:06 am    Post subject: Re: Screen resolution Reply with quote



Marco,
You can use the ChangeDisplaySettings() function; see here...

http://graphicsbb.itgo.com/solutions/enumdisplay.html

Good luck,
Damon (TeamB)
Back to top
Marco Ponti
Guest





PostPosted: Thu Oct 30, 2003 2:44 pm    Post subject: Re: Screen resolution Reply with quote




"Damon Chandler (TeamB)" <dmc27 (AT) cornell (DOT) edu> ha scritto nel messaggio
news:3F9F9F47.8D7592B0 (AT) cornell (DOT) edu...
Quote:
Marco,
You can use the ChangeDisplaySettings() function; see here...

http://graphicsbb.itgo.com/solutions/enumdisplay.html

Good luck,
Damon (TeamB)

Thanks Damon, that solved my problem.
By the way, how can i know what resolution is currently used, in order to
restore it when closing my application ?

Marco.



Back to top
Damon Chandler (TeamB)
Guest





PostPosted: Fri Oct 31, 2003 7:39 am    Post subject: Re: Screen resolution Reply with quote

Marco Ponti wrote:
Quote:

By the way, how can i know what resolution is currently used,
in order to restore it when closing my application?

If you're using the VCL, the you can use the TScreen class's Width and
Height properties (i.e., Screen->Width, Screen->Height; see also
TScreen::Monitors[] for multi-monitor support). Otherwise, you can use the
GetDeviceCaps() GDI function...

HDC const hScreenDC = GetDC(NULL);
int const width = GetDeviceCaps(hScreenDC, HORZRES);
int const height = GetDeviceCaps(hScreenDC, VERTRES);
ReleaseDC(NULL, hScreenDC);

(see http://tinyurl.com/qmcw for multi-montor suppport).

Good luck,
Damon (TeamB)

Back to top
Dragons Master
Guest





PostPosted: Sat Nov 01, 2003 12:10 pm    Post subject: Re: Screen resolution Reply with quote

| You can use the ChangeDisplaySettings() function; see here...
Quote:
http://graphicsbb.itgo.com/solutions/enumdisplay.html

Sad - I read it and I didn't really understand it - I mean I'm very newbish
with BCB, I'm running v4 (no money to buy newer versions lol) and I'm making
a stratego game that I want 800x600 but I can't figure out how to make it
work - so far I've learnt studying code snippest but this one I can't figure
out - I don't get where do u define wut resolutin you want.. can you post a
snippest that changes the res to 800x600 and one that restores it back to
wut it was - if not can you plz explain wut static_cast does? thanks..

- Ben



Back to top
Dragons Master
Guest





PostPosted: Sat Nov 01, 2003 12:49 pm    Post subject: Re: Screen resolution Reply with quote

okie I tried it out and I got some freakish bug:

[Linker Error] Unresolved external 'TForm1::ChangeResolution(tagSIZE *)'
referenced
from C:BENTESTUNIT1.OBJ.

anyways I don't seem to find the bug, I declared the function in the Uni1.h.
in the TForm1::FormCreate function I put the following:
LPSize ben;
ben->cx = 800;
ben->cy = 600;
int i = ChangeResolution(ben);

can anyone advise me with how to solve it out?

- Ben


Back to top
Egon
Guest





PostPosted: Mon Nov 03, 2003 11:53 pm    Post subject: Re: Screen resolution Reply with quote

"Dragons Master" wrote:

Quote:
okie I tried it out and I got some freakish bug:

[Linker Error] Unresolved external 'TForm1::ChangeResolution(tagSIZE *)'
referenced
from C:BENTESTUNIT1.OBJ.

anyways I don't seem to find the bug, I declared the function in the
Uni1.h. in the TForm1::FormCreate function I put the following:
LPSize ben;
ben->cx = 800;
ben->cy = 600;
int i = ChangeResolution(ben);

can anyone advise me with how to solve it out?

The function ChangeResolution() is DECLARED in header file, but is it
IMPLEMENTED in source file ?
I mean:

/* Unit1.h */
....
private:
int ChangeResolution(tagSize *MyTag);
....

---------------------

/* Unit1.cpp */
....
int TForm1::ChangeResolution(tagSize *MyTag)
{
// some body of function
}

You didn't write if your function is in source file, so my guess is
that you'll have to write it's body into the source file.

HTH,
Egon


Back to top
Dumboo
Guest





PostPosted: Mon Nov 10, 2003 9:13 am    Post subject: Re: Screen resolution Reply with quote

hi there

Quote:
okie I tried it out and I got some freakish bug:

[Linker Error] Unresolved external 'TForm1::ChangeResolution(tagSIZE *)'
referenced
from C:BENTESTUNIT1.OBJ.

anyways I don't seem to find the bug, I declared the function in the
Uni1.h.
in the TForm1::FormCreate function I put the following:
LPSize ben;
ben->cx = 800;
ben->cy = 600;
int i = ChangeResolution(ben);

can anyone advise me with how to solve it out?

looks like you have no written Funtion defination for
'TForm1::ChangeResolution(tagSIZE *)'
properly

maybe you have written it as

int ChangeResolution(LPSIZE lpSize)
{
......
}

you can do
1)

int TForm1::ChangeResolution(LPSIZE lpSize)
{
......
}

OR

2)
remove the Declaration of ChangeResolution() from the Forms class and make
it global function

hope this helps
-Dumboo









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.