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;