用delphi怎樣來實現程序的自動啟動功能﹖
解决方案 »
- delphi 将excel数据显示在StringGrid控件上
- 求助,很简单的问题,100分送上~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
- delphi2 005的intraweb 没有注册有没有什么功能的限制
- %%%%% 使用idTCPClient 如何被动接收 idTCPServer发来的消息? 顶者有分,在线等, 高手救命!!!%%%%
- 有关QuickReport两个简单问题!
- 如何建临时表?
- 怎样在DBgrid中删除多条记录?
- GUI问题--怎样让Toolbar上Button的图标与Caption横排?
- 2分!!!!!,onclick事件!!
- 如何对DbGrid中的数值列设置显示格式
- 一段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;