我这个程序编译没错,但就是实现不了目的,请各位帮忙指点.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.
解决方案 »
- 50分只求: Windows socket error: 远程主机强迫关闭了一个现有的连接. 10054 On API 'recv' 的异常名 E 是什么啊?
- 如何在Gina中用WlxMessageBox将字符显示在application desktop下?
- 当From最大化时,所有的控件要重新计算位置(最好包括所有控件的大小),怎么做?online......
- 这是什么?
- 为什么blob字段存时没有错误,取时没有东西?答者有分?
- 哪有股票分析系统源码,或者k线分析图构件?谢谢!
- 顺利调试通过李维高级篇78章,现在向9章迈进,恳请高手指点则个
- 关于TreeView
- Midas 的多线程编程问题 含出错部分代码
- 请高手解释这段话什么意思?
- 十万火急 请问大虾:如何把字符串中的数字提取出来
- 求发电子邮件的程序????? 有分
RegF.WriteString(sCaption,sExeName);应该是这段有问题,SoftwareMicrosoftWindowsCurrentVersionRun你怎么“\”都没有呢