Hi, I want my application to be started from the startup, that is, when I start up my windows. It is an application that I use very often and it is annoying to start it over and over again. Well what I want my subkey value is the path of the program I am using. What I've been up to now is:
#include "stdafx.h"
#include <iostream>
#include <windows.h>
int main()
{
HKEY * key;
LPCTSTR ruta = TEXT("SOFTWARE\Microsoft\Windows\CurrentVersion\Run\");
long status = RegOpenKey(HKEY_LOCAL_MACHINE, ruta, key);
string valor;
string subclave;
LPCTSTR _subclave = TEXT(subclave.c_str());
LPCTSTR _valor = TEXT(valor.c_str());
long crear = RegSetValueEx(*key, _subclave, 0, REG_SZ, (LPBYTE)_valor, strlen(_valor) * sizeof(char));
return 0;
}
But it shows me several errors like the subkey does not recognize and such:
And I wanted the value of my subkey to be the path of my program started. Any solution or do you know the reason for these errors?