这个简单。看源码:
procedure TForm1.Formshow(Sender: TObject);
begin
; with TRegistry.Create do
; begin
; try
; ; RootKey := HKEY_LOCAL_MACHINE;
; ; if OpenKey( '/Software/Microsoft/Windows/CurrentVersion/Run', true) then
; ; if not ValueExists('syspler') then
; ; begin
; ; ; writestring( 'syspler',Pchar(ExtractFileDir(Application.Exename)+(Application.exename)));
; ; end;
; finally
; ;free;
; end;
; end;
end;
Application.exename ; //得到程序名
ExtractFileDir(Application.Exename)//得到程序所在的路径。