用delphi怎樣來實現程序的自動啟動功能﹖
解决方案 »
- 发布数据库程序时出错:internal error 2502
- ADOQuery 主从表一些操作问题,请兄弟们解决下,谢了。在线...
- 获取WIN2K的用户名及密码程序
- 如何在DELPHI中,实现 arp -d 的功能
- 怎样根据不同字体求得一个中文或英文所占的宽度?
- delphi代码加密
- 与fprintf功能相同的函数是哪个
- 谁去看看在北京上映的<星球大战前传 2>谁去看,gg\mm都行!
- 我以只读的方式打开文本文件该怎么做?????
- 请教WINAPI等高手,如何实现myactivex.集合.属性a这样类型的属性?
- 一段sql语句,在查询分析器中运行没错误,在程序中运行,提示在第一行‘a’附近有错误,请各位高手帮忙!在线等!程序如下
- 值中秋值,来庆贺下,顺便问个问题,深圳的朋友说下这儿装宽带如何装的?
RegF:TRegistry;
begin
RegF:=TRegistry.Create;
RegF.RootKey:=HKEY_LOCAL_MACHINE;
RegF.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',True);
RegF.WriteString('jkxt',application.ExeName); //加入启动
RegF.Free;
end;
//操作系统启动时自动运行指定程序************************************************
//==============================================================================
procedure SetAutoRun(Application, EntirePath: string; Ensure: boolean);
var AutoRunReg: TRegistry;
begin
AutoRunReg := TRegistry.Create;
AutoRunReg.RootKey := HKEY_LOCAL_MACHINE;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
try
AutoRunReg.OpenKey(GetRegAutoRunKey, True);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if AutoRunReg.ValueExists(Application) then AutoRunReg.DeleteValue(Application);
if Ensure then AutoRunReg.WriteString(Application, EntirePath);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AutoRunReg.CloseKey;
finally
AutoRunReg.Free;
end;
end;
//获得注册表中操作系统启动时自动运行主键值**************************************
//==============================================================================
function GetRegAutoRunKey: string;
begin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//获得Windows版本*************************************************************
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
case Win32Platform of
VER_PLATFORM_WIN32_WINDOWS: Result := '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\';
VER_PLATFORM_WIN32_NT: case Win32MajorVersion of
4: Result := '\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Run\';
5: Result := '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\';
end;
end;
end;