unit1.pas
来自「本代码及文件是获取控制系统的delphi工程文件」· PAS 代码 · 共 50 行
PAS
50 行
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,Registry;
type
TForm1 = class(TForm)
Button2: TButton;
Label2: TLabel;
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button2Click(Sender: TObject);
var
reg: TRegistry;
result:string;
begin
Result := '';
reg := TRegistry.Create;
//生成注册表对象
with reg do
begin
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('Software\Microsoft\Windows\CurrentVersion', False);
//打开注册表
Result := ReadString('ProductID');
//得到序列号
end;
reg.Free;
label2.caption:=result;
//显示序列号
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?