Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting Screen Res/ Colours

Status
Not open for further replies.

sggaunt

Programmer
Jul 4, 2001
8,620
GB
I would like some of my apps to be able to detect the screen resolution and or the number of colours set at start up.
I suppose these are stored in the registry somewhere does anyone know where they are and or if there are any other ways to do this?

Steve
 
I know you can check this through Delphi because Ive done it but I cant for the life of me remember how. If however like myself you find your self cehcking things like this a lot you might want to check out this page


and download the freeware component called MiTeC System Information Component v.7.62. It gives a lot of info about your computer and takes up very little room in a final install.
 
There is a component called Screen which comes free with your app. Just use Screen.Width and Screen.Height for the dimensions of the screen you're on. There are also properties for the Desktop dimensions, and an array of Monitors, for dimensions of other screens attached to this computer.

Colour depth now, hmm, there I can't help you. There's TChart.IsScreenHighColor; but that's pretty lame. -- Doug Burbidge mailto:doug@ultrazone.com
 
Check out the API function EnumDisplaySettings

I found this snippet of code:

procedure TForm1.FormCreate(Sender: TObject);
var
i : Integer;
DevMode : TDevMode;
begin
i:=0;
while EnumDisplaySettings(nil,i,DevMode) do begin
with Devmode do
ListBox1.Items.Add
(Format('%dx%d %d Colors',
[dmPelsWidth,dmPelsHeight,1 shl dmBitsperPel]));
Inc(i);
end;
end;

It puts the display settings in a listbox, and combining it with screen.width and screen.height it must be possible to detect the current color mode
S. van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top