0
TCHAR szPath[MAX_PATH]; 
GetModuleFileName(NULL, szPath, MAX_PATH); 
HKEY newValue; 
RegOpenKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", &newValue); 
RegSetValueEx(newValue, "keyloggerbylee", 0, REG_SZ, (LPBYTE)szPath, sizeof(szPath)); 
RegCloseKey(newValue); 

these code start program after login,but I like to know how to start program before login in windowsin c++

  • 1
    https://www.msfn.org/board/topic/83272-how-to-run-a-program-as-a-service/ – N00byEdge Aug 25 '17 at 15:26
  • The only way to do that is to convert your code into a Windows service, which has a number of significant limitations, like not being able to display any type of user interface. Beware that lots of what you will find online about services is wildly out of date. – Cody Gray - on strike Aug 25 '17 at 16:51

0 Answers0