随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253


{函数}
function SetScreen(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
  SetScreen(1024, 768);
end;

posted on 2008-11-19 17:14  万一  阅读(...)  评论(...编辑  收藏