antiblock
Elveron
  • Chatbox

    Did you check out our Discord? https://discord.gg/FFdvMjk9xA
    You don't have permission to chat.
    Load More
Sign in to follow this  
V¡®u§

Fazendo aplicação iniciar com o windows usando o C++ Builder

1 post in this topic

Imagem colocada

Coloque um Ttimer em sua aplicação e insira o seguinte código nele:

TRegistry *Reg = new TRegistry(); // cria e iniciar a variavel Reg
AnsiString S; // cria uma variavel string com o nome S


// A linha abaixo atribui o nome do aplicativo a variavel S
S =ExtractFileDir(Application->ExeName)+"\\"+ExtractFileName(Application->ExeName);
Reg->RootKey = HKEY_LOCAL_MACHINE; // Define a chave root
Reg->OpenKey("SOFTWARE\\MICROSOFT\\WINDOWS\\CURRENTVERSION\\RUN",true);
Reg->WriteExpandString("Nome do seu sistema",S); // Escreve um valor de sequencia expansivel.
Reg->CloseKey(); // fecha a chave aberta
delete Reg; // Libera a variavel



OBS: Não esqueça de incluir #include "dstring.h" e #include "registry.hpp"

Share this post


Link to post
Share on other sites
antiblock
https://arwen2.global/

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