;XOldDev: _devicemodeA; //保存原来的设置
XOldScreen: record //原来的Screen区域
Width, Height, Colors: Integer;
end;
XWorkArea: TRect; //程序要用的工作区
XDisplayWidth: Integer=800; XDisplayHeight: Integer=600; //桌面大小
procedure GetOldScreen; //取原来的设置
var Dev: _devicemodeA;
begin
XOldDev:=Dev;
XOldScreen.Width:=GetSystemMetrics(SM_CXSCREEN);
XOldScreen.Height:=GetSystemMetrics(SM_CYSCREEN);
XOldScreen.Colors:=0;
end;
function SET_WinWorkArea(W, H: Integer): Integer; //设置新的
begin
XOldDev.dmPelsWidth:=W;
XOldDev.dmPelsHeight:=H;
XOldDev.dmFields:=DM_PELSWIDTH+DM_PELSHEIGHT;
Result:=ChangeDisplaySettings(XOldDev, 0); //API
if (Result>=0)
then begin XDisplayWidth:=W; XDisplayHeight:=H; end;
SystemParametersInfo(SPI_GETWORKAREA, 0, @XWorkArea, 0);
end;