部分代码
var
Form1: TForm1;
xx,yy:integer;
lpMode:TDeviceMode;
function DynamicResolution(x,y: word):BooL;
implementation{$R *.dfm}
function DynamicResolution(x,y: word):BooL;
var
lpDevMode:TDeviceMode;
begin
Result:=EnumDisplaySettings(nil,0,lpDevmode);
if Result then
begin
lpDevMode.dmFields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
lpDevMode.dmPelsWidth :=x;
lpDevMode.dmPelsHeight :=y;
Result := ChangeDisplaySettings(lpDevMode, 0) = DISP_CHANGE_SUCCESSFUL;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if DynamicResolution(1024, 768) then
ShowMessage('Now is 1024*768');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if (lpMode.dmPelsWidth<>800)and(lpMode.dmPelsHeight<>600) then
DynamicResolution(800,600);
end;请问怎么解决这个问题?
var
Form1: TForm1;
xx,yy:integer;
lpMode:TDeviceMode;
function DynamicResolution(x,y: word):BooL;
implementation{$R *.dfm}
function DynamicResolution(x,y: word):BooL;
var
lpDevMode:TDeviceMode;
begin
Result:=EnumDisplaySettings(nil,0,lpDevmode);
if Result then
begin
lpDevMode.dmFields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
lpDevMode.dmPelsWidth :=x;
lpDevMode.dmPelsHeight :=y;
Result := ChangeDisplaySettings(lpDevMode, 0) = DISP_CHANGE_SUCCESSFUL;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if DynamicResolution(1024, 768) then
ShowMessage('Now is 1024*768');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if (lpMode.dmPelsWidth<>800)and(lpMode.dmPelsHeight<>600) then
DynamicResolution(800,600);
end;请问怎么解决这个问题?
看来csdn人气不行了。
高手都走了。
人们不关心初学者。
问题虽然水平不高。但对于我们菜鸟来说却很重要。
ChangeDisplaySettings(lpDevMode, CDS_UPDATEREGISTRY)