function EnumDisplaySettingsM(lpszDeviceName: PChar; iModeNum: Integer;<br> var lpDevMode: TDeviceMode): Integer; stdcall; external 'User32.DLL' name 'EnumDisplaySettingsA';<br><br>procedure ResizeScreen; //更改<br>var<br> CurrentScreenMode: TDeviceMode;<br> bNoFound,bEnd : boolean;<br> iNum : Integer;<br>begin<br> //保存当前屏幕分辨率<br> OldScreenMode.dmFields:= DM_PELSWIDTH + DM_PELSHEIGHT<br> + DM_DISPLAYFREQUENCY;<br> OldScreenMode.dmSize := SizeOf(OldScreenMode);<br> EnumDisplaySettingsM(nil,-1,OldScreenMode);<br><br> //修改当前屏幕分辨率为800*600<br> bNoFound := True;<br> bEnd := False;<br> iNum := 0;<br> CurrentScreenMode.dmFields:=DM_PELSWIDTH + DM_PELSHEIGHT;<br> OldScreenMode.dmSize := SizeOf(CurrentScreenMode);<br> while bNoFound And (Not bEnd) do<br> begin<br> bEnd := EnumDisplaySettingsM(nil,iNum,CurrentScreenMode)=0;<br> iNum := iNum + 1;<br> if (CurrentScreenMode.dmPelsWidth = 800) AND<br> (CurrentScreenMode.dmPelsHeight = 600) then<br> bNoFound := False;<br> end;<br> CurrentScreenMode.dmDisplayFrequency := OldScreenMode.dmDisplayFrequency;<br><br> if (Not bNoFound) then<br> begin<br> CurrentScreenMode.dmFields:=DM_PELSWIDTH + DM_PELSHEIGHT +<br> + DM_DISPLAYFREQUENCY;<br> ChangeDisplaySettings(CurrentScreenMode,CDS_RESET);<br> end<br> else<br> begin<br> ShowMessage('Not support');<br> end;<br>end;<br><br>procedure RestoreScreen; //恢复<br>begin<br> ChangeDisplaySettings(OldScreenMode,CDS_RESET);<br>end;