Delphi编程之系统OEM DIY

具体代码如下:

//转载请注明出处
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, ExtDlgs,Registry;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit4: TEdit;
    Button1: TButton;
    GroupBox2: TGroupBox;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Label6: TLabel;
    Edit5: TEdit;
    Label7: TLabel;
    Edit6: TEdit;
    OpenPictureDialog1: TOpenPictureDialog;
    Image1: TImage;
    Label5: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.Button1Click(Sender: TObject);
begin
if (Edit1.Text='') and (Edit2.Text='') and (Edit3.Text='') and (Edit4.Text='') and (Edit5.Text='') then
MessageBox(0,'您还没有填写相关信息呢!','提示信息',64)
else
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
Edit6.Text:= ExtractFileDir(OpenPictureDialog1.FileName)+'\'+ExtractFileName(OpenPictureDialog1.FileName);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
if Image1.Picture.Bitmap.Empty then
MessageBox(0,'您还没有载入图片呢!','提示信息',64)
else
Image1.Picture.Bitmap:=nil;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
MessageBox(0,'作者:过往云霄 QQ:154103651'+#13+#13'操作系统:Windows 10简体中文专业版64位'+#13+#13'编程工具:Delphi 2010英文架构师版','提示信息',64);
end;

procedure TForm1.Button5Click(Sender: TObject);
var
Reg:TRegistry;
begin
Reg:=TRegistry.Create;
try
  Reg.Access:=KEY_WOW64_64KEY or KEY_WRITE;
  Reg.RootKey:=HKEY_LOCAL_MACHINE;
  if Reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation',True) then
  begin
    Reg.WriteString('Manufacturer',Edit1.Text);
    Reg.WriteString('Model',Edit2.Text);
    Reg.WriteString('SupportHours',Edit3.Text);
    Reg.WriteString('SupportPhone',Edit4.Text);
    Reg.WriteString('SupportURL',Edit5.Text);
    //Reg.WriteString('Logo',ExtractFileName(OpenPictureDialog1.FileName));  获得文件名称
     Reg.WriteString('Logo',ExtractFileDir(OpenPictureDialog1.FileName)+'\'+ExtractFileName(OpenPictureDialog1.FileName));
    Reg.CloseKey;
  end;
finally
Reg.Free;
end;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
Close;
end;

end.

 

转载于:https://www.cnblogs.com/guowangyunxiao/p/5287408.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值