📄 share.pas
字号:
unit Share;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Registry, StdCtrls;
Const
sReg1='SYSTEM\ControlSet001\Control\ComputerName\ComputerName';
sKey1='ComputerName';
Type
TShare=class
public
function GetRegistryValue(sPath,sKey:string): string;
function WriteRegistryValue(sPath,sKey,sValue:string):Boolean;
End;
implementation
function TShare.GetRegistryValue(sPath,sKey:string): string;
var
Registry: TRegistry;
S: string;
begin
Registry := TRegistry.Create;
try
Registry.RootKey := HKEY_LOCAL_MACHINE;
Registry.OpenKey(sPath, True);
Result := Registry.ReadString(sKey);
finally
Registry.Free;
end;
end;
function TShare.WriteRegistryValue(sPath,sKey,sValue:string):Boolean;
var
Registry: TRegistry;
S: string;
begin
Registry := TRegistry.Create;
try
Registry.RootKey := HKEY_LOCAL_MACHINE;
Registry.OpenKey(sPath, True);
Registry.WriteString(sKey,sValue);
Result := True;
except
Result := False;
end;
Registry.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -