AD商业广告自由选择
AD商业广告自由选择

HH8 256 色窗口化原理

正文概述 开源人   2025-03-09 16:16:23  
Bengin

 function GetColorDepth: integer ;//得到桌面颜色深度
var
  dc: HDC; 
begin 
  dc := GetDC(0); 
  Result := GetDeviceCaps(dc, BITSPIXEL); 
  ReleaseDC(0, dc); 
end;

 function Resolution(X:word):boolean;
var
  DevMode:TDeviceMode;
begin
  Result:=EnumDisplaySettings(nil,0,DevMode);
  if Result then
  begin
    DevMode.dmFields:=DM_BITSPERPEL;
    DevMode.dmBitsPerPel:=x;
    Result:=ChangeDisplaySettings(DevMode,0)=DISP_CHANGE_SUCCESSFUL;
  end;
end;

 function GetDisplayFrequency: Integer;//得到刷新率
var
  DeviceMode: TDeviceMode;
begin
  EnumDisplaySettings(nil, Cardinal(-1), DeviceMode);
  Result := DeviceMode.dmDisplayFrequency;
end;

procedure ChangeDisplayFrequency(iFrequency:Integer);//更改刷新率,在Win2000下成功
var
  DeviceMode: TDeviceMode;
begin
  EnumDisplaySettings(nil,Cardinal(-1), DeviceMode);
  DeviceMode.dmDisplayFrequency:=Cardinal(iFrequency);
  ChangeDisplaySettings(DeviceMode,CDS_UPDATEREGISTRY);
end;

end;

begin
  Application.Initialize;
  Application.Title := 'HH8.Net';
  SplashForm:=TFormSplash.Create(nil);
  SplashForm.ShowModal;//显示登陆窗
  SplashForm.Free;
  Waitandpass(500);
  if FullScreen then //这是检测不是全屏
  Begin
    OldColor:=GetColorDepth;
    oldFreq:=GetDisplayFrequency;
    Resolution(8); //设置显示模式为256色
  End;

  Application.CreateForm(TFrmMain, FrmMain);
  Application.CreateForm(TFrmDlg, FrmDlg);

  Application.Run;
  FreeLibrary(Dllhandle);
  if FullScreen then//退出还原 显示模式
  Begin
    Resolution(OldColor);
  if OldFreq>0 then 
    ChangeDisplayFrequency(OldFreq);
  End;
end
procedure TfrmMain.FormCreate(Sender: TObject);

  FrmMain.BorderStyle:=bsSizeable; 
  FrmMain.BorderIcons:= FrmMain.BorderIcons -[biMaximize]; //不能最大化
procedure TfrmMain.AppOnIdle (Sender: TObject; var Done: Boolean);
var
  FClientRect:TRect; //添加一个变量

  FClientRect:=FrmMain.ClientRect;
  windows.ClientToScreen(Frmmain.Handle, FClientRect.TopLeft);
 
  DXDraw.Primary.Draw(FClientRect.Left, FClientRect.Top, DXDraw.Surface.ClientRect, DXDraw.Surface,False); 
 


声明:本文系互联网搜索而收集整理,不以盈利性为目的,文字、图文资料源于互联网且共享于互联网。
如有侵权,请联系 yao4fvip#qq.com (#改@) 删除。