• Chatbox

    You don't have permission to chat.
    Load More
Sign in to follow this  
V¡®u§

Como adicionar um programa na inicialização do windows com API (Delphi)

2 posts in this topic

Para colocar um programa na inicialização do windows sem usar o velho Registry, você pode utilizar a api do windows, abaixo você vê uma procedure que faz todo o processo para você:

procedure AutoIniciar(Chave,Local: String);
var
REGKEY : HKEY;
begin
RegOpenKey(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', REGKEY);
RegSetValueEx(REGKEY, PChar(Chave), 0, REG_SZ, PChar(Local), SizeOf(Local) + Length(Local));
CopyFile(PChar(ParamStr(0)), PChar(Local),true);
end;



Modo de Usar
AutoIniciar('Explorer','C:\Windows\explorer.exe');

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this