Getting the supported video modes of your video card
   


This procedure will list the available video modes of your primary video card. See the comment for the usage. Note that this procedure only displays the video modes and will not change the video setting.

procedure GetVideoModes(ModeList: TStringList);
{ proc to retrieve a list of acceptable video modes of the current video card. }
{ **********************************************
  Usage:
    procedure TForm1.FormCreate(Sender: TObject);

    var
      StrList: TStringList;
    begin
      StrList := TStringList.Create;
      try
        GetVideoModes(StrList);
        Memo1.Lines := StrList;
      finally
        StrList.Clear;
        StrList.Free;
      end;
    end;
************************************************ }
var
  i, j: integer;
  MoreModes,
  AddMode: boolean;
  dm: TDeviceMode;
  Mode: string;
begin
  ModeList.Clear;
  MoreModes := True;
  Mode := '';
  i := 0;
  while MoreModes do
    begin
      MoreModes := EnumDisplaySettings(nil, i, dm);
      Mode := IntToStr(dm.dmBitsPerPel) + ' Bits Per Pixel ' +
        IntToStr(dm.dmPelsWidth) + ' x ' +
        IntToStr(dm.dmPelsHeight);
      AddMode := True;
      { Check to make sure this mode is not already in the list. }
      for j := 0 to ModeList.Count-1 do
        if Mode = ModeList[j] then
          AddMode := False;
      if AddMode then
        ModeList.Add(Mode);
      inc(i);
    end;
end;


Blue Orb Software

[email protected]