请问。。如何动态的修改显示器的刷新频率 ( 积分: 50 )

  • 主题发起人 主题发起人 windtake
  • 开始时间 开始时间
W

windtake

Unregistered / Unconfirmed
GUEST, unregistred user!
我的机器在修改了显示器的分辨率之后刷新频率会跳回60,如何在改回
分辨率之后,刷新频率照常。我写了一个程序可以动态修改分辨率却无法得到
原来的刷新频率。。请高手指点。。。
procedure TForm1.Button1Click(Sender: TObject);
var
t:integer;
DeviceMode:tDevicemode;
begin
EnumDisplaySettings(nil, Cardinal(-1), DeviceMode);
t:= DeviceMode.dmDisplayFrequency;
DeviceMode.dmfields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
DeviceMode.dmDisplayFrequency:=75;
DeviceMode.dmpelswidth:=1024;
DeviceMode.dmpelsheight:=768;
ChangeDisplaySettings(DeviceMode,0);
showmessage(inttostr(DeviceMode.dmDisplayFrequency));
end;

procedure TForm1.FormCreate(Sender:TObject);
var
devmode:tDevicemode;
begin
orignwidth:=800;
orignheight:=600;
if screen.width<>orignwidth then begin
if EnumDisplaySettings(nil,0,devmode) then begin
devmode.dmfields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
devmode.dmpelswidth:=orignwidth;//宽度
devmode.dmpelsheight:=orignheight;//高度
ChangeDisplaySettings(devmode,0);//更改设置
end;
end;
end;
 
我的机器在修改了显示器的分辨率之后刷新频率会跳回60,如何在改回
分辨率之后,刷新频率照常。我写了一个程序可以动态修改分辨率却无法得到
原来的刷新频率。。请高手指点。。。
procedure TForm1.Button1Click(Sender: TObject);
var
t:integer;
DeviceMode:tDevicemode;
begin
EnumDisplaySettings(nil, Cardinal(-1), DeviceMode);
t:= DeviceMode.dmDisplayFrequency;
DeviceMode.dmfields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
DeviceMode.dmDisplayFrequency:=75;
DeviceMode.dmpelswidth:=1024;
DeviceMode.dmpelsheight:=768;
ChangeDisplaySettings(DeviceMode,0);
showmessage(inttostr(DeviceMode.dmDisplayFrequency));
end;

procedure TForm1.FormCreate(Sender:TObject);
var
devmode:tDevicemode;
begin
orignwidth:=800;
orignheight:=600;
if screen.width<>orignwidth then begin
if EnumDisplaySettings(nil,0,devmode) then begin
devmode.dmfields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
devmode.dmpelswidth:=orignwidth;//宽度
devmode.dmpelsheight:=orignheight;//高度
ChangeDisplaySettings(devmode,0);//更改设置
end;
end;
end;
 
请不吝指教`````
 
通过修改注册表可以实现.

[HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Class/Display/0001/DEFAULT]
&quot;Mode&quot;=&quot;16,640,480&quot;
&quot;drv&quot;=&quot;mgapdx64.drv&quot;
&quot;drv2&quot;=&quot;mgapdx64.drv&quot;
&quot;vdd&quot;=&quot;*vdd,*vflatd&quot;
&quot;minivdd&quot;=&quot;mgapdx64.vxd&quot;
&quot;minivdd2&quot;=&quot;mgapdx64.vxd&quot;
&quot;RefreshRate&quot;=&quot;75&quot;
&quot;DDC&quot;=&quot;1&quot;
&quot;ResumeReset&quot;=&quot;1&quot;
&quot;CHIPID&quot;=hex:00,00,00,00,00,00

上列键值显示了你当前的显示配置.其中&quot;RefreshRate&quot;=&quot;75&quot;
表明当前的刷新频率. 你可手工修改.不过不能随意设置.其可选值可以在下列键之中得到:
[HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Class/Display/0001/MODES]
其根据颜色位值和分辨率提供刷新选项 例如:
[HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Class/Display/0001/MODES/16/1280,1024]
@=&quot;60 75 85 &quot;

16位色,1280X1024可选刷新频率为:60,75,85.
 
procedure TForm1.ChangeSreenDisplay(x, y: Integer);
var
lpDevMode : TDeviceMode;
begin
EnumDisplaySettings(nil, 0, lpDevMode);
lpDevMode.dmFields:=DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY;
lpDevMode.dmPelsWidth:=x;
lpDevMode.dmPelsHeight:=y;
lpDevMode.dmDisplayFlags:=DM_DISPLAYFREQUENCY;
lpDevMode.dmDisplayFrequency:=85; //刷新频率
ChangeDisplaySettings(lpDevMode, CDS_UPDATEREGISTRY);
end;

procedure TForm1.screen1Click(Sender: TObject);
begin
ChangeSreenDisplay(800,600);
end;
 
后退
顶部