我有一个exe程序
但是我想只要电脑开启
程序自动运行
但是我不想用计划任务
最好是用delphi写的例子
但是我想只要电脑开启
程序自动运行
但是我不想用计划任务
最好是用delphi写的例子
解决方案 »
- delphi7 中添加第3方控件的问题?
- MYSQL的Blob字段的内容过长时无法完全保存成文件
- 请教一网络检测代码中的问题
- 如何编程实现把WebBrowser中内容存储为mht格式
- 这里有谁写共享软件收到过用户主动寄来的注册费吗?
- 關於Edit事件簡單問題
- 一个6000000条纪录的dbf文件,在本地,我用程序和其他的关联表格进行操作以后,如何加强效率(内详)
- DELPHI7下的idTcpClient和idTcpServer控件的数据接收问题
- 控件如何派生自己的PropertyEditor?
- 用delphi开发一个向所有oicq用户发讯息的软件,可行性如何?
- 怎样在DELPHI里动态加载ActiveX控件(TOleContainer)除外(1000分悬赏)
- 使用Getmem然后freemem提示:Variable 'xxx' might not have been initialized??
Win9x就在Registry的Run下面具体代码等别人来说了,我只给方法的:)http://lysoft.7u7.net
里面加入
var
Reg:Tregistry;
begin
Reg:=Tregistry.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
Try
Reg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True);
Reg.WriteString('天地数据服务',ExtractFileDir(application.ExeName)+'\abc.exe');
finally
Reg.CloseKey;
Reg.Free;
end;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,registry;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure setautorun(aprogtitle,acmdline:string;arunonce:boolean);
var hkey:string;
hreg:treginifile;
begin
if arunonce then
//程序只运行一次
hkey:='once'
else
hkey:='';
hreg:=treginifile.Create('');
//treginifile类的对象需要创建
hreg.RootKey:=HKEY_LOCAL_MACHINE;
//设置根值
hreg.WriteString('software\microsoft\windows\currentversion\run'
+hkey+#0,
aprogtitle,
//程序名称,可以自己定义值
acmdline);
//命令行数据,必须为该程序的绝对路径+程序完整名称
hreg.destroy;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
setautorun(application.Title,application.ExeName,false);
//application.Title 程序标题
//application.ExeName 程序的绝对路径+程序完整名称
end;end.解决了给分吧