Board index » delphi » screen resolution

screen resolution


2003-10-15 02:53:45 AM
delphi52
Hi
My project has a splash form and form1 (menu) leading to the other forms.
Using the function 'SetScreenResolution' I can change to the one I want,
having first read the current setting. My problem is I run 'SetScreenRes'
from the prior to the splash screen opening, I read old height/width but how
do I pass this onto the menu form for resetting on close or is my code in
the wrong place ?
 
 

Re: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 am using BCB 5 and Windows 2000 - XP.
Any help will be very appreciated !
Thanks, Marco
 

Re:screen resolution

Marco,
You can use the ChangeDisplaySettings() function; see here...
graphicsbb.itgo.com/solutions/enumdisplay.html
Good luck,
Damon (TeamB)
 

Re:screen resolution

"Damon Chandler (TeamB)" <XXXX@XXXXX.COM>ha scritto nel messaggio
Quote
Marco,
You can use the ChangeDisplaySettings() function; see here...

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.
 

Re:screen resolution

Marco Ponti writes:
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 tinyurl.com/qmcw for multi-montor suppport).
Good luck,
Damon (TeamB)
 

Re:screen resolution

| You can use the ChangeDisplaySettings() function; see here...
| graphicsbb.itgo.com/solutions/enumdisplay.html
:( - I read it and I didn't really understand it - I mean I am very newbish
with BCB, I am running v4 (no money to buy newer versions lol) and I am making
a stratego game that I want 800x600 but I can not figure out how to make it
work - so far I have learnt studying code snippest but this one I can not 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
 

Re:screen resolution

okie I tried it out and I got some freakish bug:
[Linker Error] Unresolved external 'TForm1::ChangeResolution(tagSIZE *)'
referenced
from C:\BEN\TEST\UNIT1.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
 

Re:screen resolution

"Dragons Master" writes:
Quote
okie I tried it out and I got some freakish bug:

[Linker Error] Unresolved external 'TForm1::ChangeResolution(tagSIZE *)'
referenced
from C:\BEN\TEST\UNIT1.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 will have to write it is body into the source file.
HTH,
Egon
 

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:\BEN\TEST\UNIT1.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
 

Re:screen resolution

I would change screen resolution, using C++Builder 6 Enterprise, to 800x600
(example) at start-up of my program and then restore original values at the
end.
I have lost the program list of a routine I made, remember using Windows API
instructions, and if someone is so kind to help me I will save a lot of
time.
Many thnks
Nerio
P.S. If I am not at the correct newsgroup sorry and please address me to
exact way
 

Re:screen resolution

Nerio writes:
Quote
I would change screen resolution, using C++Builder 6 Enterprise, to 800x600
(example) at start-up of my program and then restore original values at the
end.
Maybe ChangeDisplaySettings() or ChangeDisplaySettingsEx() can
help?
msdn.microsoft.com/library/default.asp
 

Re:screen resolution

"Bob Gonder" <XXXX@XXXXX.COM>ha scritto nel messaggio
Quote
Nerio writes:

>I would change screen resolution, using C++Builder 6 Enterprise, to
>800x600
>(example) at start-up of my program and then restore original values at
>the
>end.

Maybe ChangeDisplaySettings() or ChangeDisplaySettingsEx() can
help?

msdn.microsoft.com/library/default.asp



Many thanks Bob,
that is the solution; and very simple!
 

Re:screen resolution

Hi
I have just tired to install my application on a new xp note book. The app.
was created at 800*600 and the code below has worked for years. Now
regardless of the new pc's screen resolution the app. is way of the screen
and distored. Any help would be much appriciated. If this is wrong group
please advise on correct one.
Thanks
procedure TOpeningScreen.FormCreate(Sender: TObject);
const
ScreenWidth: LongInt = 800;
ScreenHeight: LongInt = 600;
var
OLD_ScreenWidth:longint;
I: Integer;
Temp: TComponent;
begin
scaled := true;
if (screen.width <>ScreenWidth)
then
begin
old_ScreenWidth:= screen.width;
height := longint(height) * longint(screen.height) div ScreenHeight;
width := longint(width) * longint(screen.width) div ScreenWidth;
scaleBy(screen.width, ScreenWidth);
for I := ComponentCount - 1 downto 0 do
begin
with Components[I] do
begin
font.size:=
(screen.width div old_screenwidth) * font.size
end;
end
end;
end;}