将程序加载到启动项中,并隐藏任务栏下的图标

 

将程序加载到启动项中,并隐藏任务栏下的图标

首先需要引用单元registry;
setwindowlon(application.Handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
将visible设为false,隐藏form.接着更改注册表的启动项,

reg:=Tregistry.create; reg.rootkey:=HKEY_LOCAL_MACHINE;
if not reg.keyexists('SOFTWARE\client') then

begin reg.createKey('software\client');
reg.openkey('SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN', true);
reg.WriteString('client','c:\client.exe');//把程序加载到启动项
end; reg.CloseKey;
 

你可能感兴趣的:(Delphi)