function Resolution(X,Y:word):boolean;
var
DevMode:TDeviceMode;
begin
Result:=EnumDisplaySettings(nil,0,DevMode);
if Result then
begin
DevMode.dmFields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
DevMode.dmPelsWidth:=X;
DevMode.dmPelsHeight:=Y;
Result:=ChangeDisplaySettings(DevMode,0)=DISP_CHANGE_SUCCESSFUL;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if Resolution(800,600) then
ShowMessage('800×600模式!');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if Resolution(1280,1024) then
ShowMessage('1280X1024模式!');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if Resolution(1024,768) then
ShowMessage('1024X768模式!');
end;