我这个程序编译没错,但就是实现不了目的,请各位帮忙指点.unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
uses Registry; //声明注册表单元
Procedure AutoRun(sCaption,sExeName:String); //sCaption为项目名,sExeName为程序名
var
RegF:Tregistry; //定义变量RegF
begin
RegF := Tregistry.Create;//创建变量RegF
RegF.RootKey := HKEY_LOCAL_MACHINE;//指向要操作的根键
if RegF.OpenKey('SoftwareMicrosoftWindowsCurrentVersionRun',true) then
RegF.WriteString(sCaption,sExeName);
RegF.Free;
ShowMessage('有响应');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
AutoRun('D:\GHMIS2003\NBHOTEL\HMIS6.exe',Paramstr(0)); //Paramstr(0)函数返回带路径的程序名end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
uses Registry; //声明注册表单元
Procedure AutoRun(sCaption,sExeName:String); //sCaption为项目名,sExeName为程序名
var
RegF:Tregistry; //定义变量RegF
begin
RegF := Tregistry.Create;//创建变量RegF
RegF.RootKey := HKEY_LOCAL_MACHINE;//指向要操作的根键
if RegF.OpenKey('SoftwareMicrosoftWindowsCurrentVersionRun',true) then
RegF.WriteString(sCaption,sExeName);
RegF.Free;
ShowMessage('有响应');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
AutoRun('D:\GHMIS2003\NBHOTEL\HMIS6.exe',Paramstr(0)); //Paramstr(0)函数返回带路径的程序名end;end.
RegF.WriteString(sCaption,sExeName);应该是这段有问题,SoftwareMicrosoftWindowsCurrentVersionRun你怎么“\”都没有呢