whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

76 Visitors Online


 
...list all available screen resolutions?
Autor: phadeMAN
Homepage: http://www.criminalenergies.de
[ Print tip ]  

Tip Rating (16):  
     


procedure TForm1.Button1Click(Sender: TObject);
var
  
DC: THandle;    // display context
  
Bits: Integer;    // bits per pixel
  
HRes: Integer;    // horizontal resolution
  
VRes: Integer;    // vertical resolution
  
DM: TDevMode;   // to Save EnumDisplaySettings
  
ModeNum: Longint;    // video mode number
  
Ok: Bool;
  fre: Integer;    // refresh rate
begin
  
DC := GetDC(Handle);
  Bits := GetDeviceCaps(DC, BITSPIXEL);
  HRes := GetDeviceCaps(DC, HORZRES);
  VRes := GetDeviceCaps(DC, VERTRES);
  fre := GetDeviceCaps(DC, VREFRESH);
  // Show Current Resolution
  
Edit1.Text := Format('%d bit, %d x %d', [Bits, HRes, VRes]);
  ReleaseDC(Handle, DC); // Show all modes available ModeNum := 0;  // The 1st one
  
ModeNum := 0;
  EnumDisplaySettings(nil, ModeNum, DM);
  ListBox1.Items.Add(Format('%d bit, %d x %d bei %d Hz', [DM.dmBitsPerPel,
    DM.dmPelsWidth, DM.dmPelsHeight, Dm.dmDisplayFrequency]));
  Ok := True;
  while Ok do
  begin
    
Inc(ModeNum); // Get next one
    
Ok := EnumDisplaySettings(nil, ModeNum, DM);
    ListBox1.Items.Add(Format('%d bit, %d x %d bei %d Hz', [DM.dmBitsPerPel,
      DM.dmPelsWidth, DM.dmPelsHeight, Dm.dmDisplayFrequency]));
  end;
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners