| View previous topic :: View next topic |
| Author |
Message |
Marco Ponti Guest
|
Posted: Wed Oct 29, 2003 10:13 am Post subject: Screen resolution |
|
|
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
|
|
| Back to top |
|
 |
Marco Ponti Guest
|
Posted: Thu Oct 30, 2003 2:44 pm Post subject: Re: Screen resolution |
|
|
"Damon Chandler (TeamB)" <dmc27 (AT) cornell (DOT) edu> ha scritto nel messaggio
news:3F9F9F47.8D7592B0 (AT) cornell (DOT) edu...
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
|
Posted: Fri Oct 31, 2003 7:39 am Post subject: Re: Screen resolution |
|
|
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
|
Posted: Sat Nov 01, 2003 12:10 pm Post subject: Re: Screen resolution |
|
|
| You can use the ChangeDisplaySettings() function; see here...
- 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
|
Posted: Sat Nov 01, 2003 12:49 pm Post subject: Re: Screen resolution |
|
|
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
|
Posted: Mon Nov 03, 2003 11:53 pm Post subject: Re: Screen resolution |
|
|
"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
|
Posted: Mon Nov 10, 2003 9:13 am Post subject: Re: Screen resolution |
|
|
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 |
|
 |
|