您的位置:首页 > 编程语言 > Delphi

用KOL操作注册表(非DELPHI的registry)

2013-02-16 13:38 330 查看
{ KOL MCK } // Do not remove this line!
{$DEFINE KOL_MCK}
unit main;

interface

{$IFDEF KOL_MCK}
uses Windows, Messages, ShellAPI, KOL {$IFNDEF KOL_MCK}, mirror, Classes, Controls, mckControls, mckObjs, Graphics,
mckCtrls {$ENDIF (place your units here->)}, KolExRegistry{哎!真不容易,三天才找到该单元应该放在这里,其实人家明明写着。};
{$ELSE}
{$I uses.inc}
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
{$ENDIF}

type
{$IFDEF KOL_MCK}
{$I MCKfakeClasses.inc}
{$IFDEF KOLCLASSES} TForm1 = class; PForm1 = TForm1; {$ELSE OBJECTS} PForm1 = ^TForm1; {$ENDIF CLASSES/OBJECTS}
{$IFDEF KOLCLASSES}{$I TForm1.inc}{$ELSE} TForm1 = object(TObj) {$ENDIF}
Form: PControl;Reg:PExRegistry;{放在这里}
{$ELSE not_KOL_MCK}
TForm1 = class(TForm)
{$ENDIF KOL_MCK}
KOLProject1: TKOLProject;
KOLForm1: TKOLForm;
Button1: TKOLButton;
procedure Button1Click(Sender: PObj);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;

{$IFDEF KOL_MCK}
procedure NewForm1( var Result: PForm1; AParent: PControl );
{$ENDIF}

implementation

{$IFNDEF KOL_MCK} {$R *.DFM} {$ENDIF}

{$IFDEF KOL_MCK}
{$I main_1.inc}
{$ENDIF}

function GetCurrentDir: string;
begin
GetDir(0, Result);
end;

procedure TForm1.Button1Click(Sender: PObj);
begin
if assigned(Reg) then reg.free;
Reg:=NewExRegistry;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE',true);
Reg.CreateKey('KolExRegistry');
Reg.OpenKey('KolExRegistry',true);
Reg.WriteString('Path',GetCurrentDir);
Reg.CloseKey;
//form.Close;
end;
end.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: