Delphi源码3D加速便捷打开关闭小工具代码分享
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,REGISTRY;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Reg:TRegistry;
begin
Reg:=TRegistry.Create;
if Button1.Caption = '关闭3D加速 ' then begin
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\DirectDraw',True);
Reg.WriteInteger('EmulationOnly',1);
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Wow6432Node\Microsoft\DirectDraw',True);
Reg.WriteInteger('EmulationOnly',1);
Button1.Caption:='开启3D加速 ';
ShowMessage('已关闭3D加速');
end else begin
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Microsoft\DirectDraw',True);
Reg.WriteInteger('EmulationOnly',0);
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Wow6432Node\Microsoft\DirectDraw',True);
Reg.WriteInteger('EmulationOnly',0);
Button1.Caption:='关闭3D加速 ';
ShowMessage('已开启3D加速');
end;
Reg.CloseKey;
end;
end.
|