📄 unit6.pas
字号:
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls,registry,shlobj,mmsystem;
type
TForm6 = class(TForm)
Panel1: TPanel;
GroupBox1: TGroupBox;
Label1: TLabel;
GroupBox2: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
GroupBox3: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
GroupBox4: TGroupBox;
CheckBox1: TCheckBox;
BitBtn3: TBitBtn;
op1: TOpenDialog;
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
procedure regfile(myext,myfiletype,mydescription,exe:string;icon:integer;doupdate:boolean=false);
end;
var
Form6: TForm6;
implementation
{$R *.dfm}
procedure tform6.regfile(myext,myfiletype,mydescription,exe:string;icon:integer;doupdate:boolean=false);
var
reg:tregistry;
begin
reg:=tregistry.Create;
try
reg.RootKey:=HKEY_CLASSES_ROOT;
reg.OpenKey(myext,true);
reg.WriteString('',myfiletype);
reg.CloseKey;
reg.OpenKey(myfiletype,true);
reg.WriteString('',mydescription);
reg.CloseKey;
reg.OpenKey(myfiletype+'defaulticon',true);
reg.WriteString('',exe+','+inttostr(icon));
reg.CloseKey;
reg.OpenKey(myfiletype+'\shell\open',true);
reg.WriteString('','&open');
reg.CloseKey;
REG.OpenKey(MYFILETYPE+'\shell\open\command',true);
reg.WriteString('','"'+exe+'" "'+'%1"');
reg.CloseKey;
if doupdate then
shchangenotify(shcne_assocchanged,shcnf_idlist,nil,nil);
finally
reg.Free;
end;
end;
procedure TForm6.BitBtn2Click(Sender: TObject);
begin
playsound(pchar('down1'),hinstance,snd_async or snd_resource);
regfile(edit1.Text,edit2.Text,edit3.Text,edit4.Text,strtoint(edit5.Text),checkbox1.Checked);
close;
end;
procedure TForm6.BitBtn1Click(Sender: TObject);
begin
playsound(pchar('down1'),hinstance,snd_async or snd_resource);
close;
end;
procedure TForm6.BitBtn3Click(Sender: TObject);
begin
if op1.Execute then
edit4.Text:=op1.FileName;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -