Witam.Chciałbym dodać swój programik do tych uruchamianych wraz ze startem systemu.Tylko za pomocą rejestru ,a nie autostart.Umieszczam na początku kodu takie linijki :
HKEY hkey;
RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", &hkey);
RegSetValueEx(hkey, "Monitoring", 0, REG_SZ, (const BYTE*)"C:\\Monitoring.exe", 18);
Niestety program wtedy się nie kompiluje i wyrzuca takie błędy:
1>------ Build started: Project: wintoolsdeb, Configuration: Debug Win32 ------
1> wintoolsdeb.cpp
1>c:\users\michal\desktop\etapy\wintoolsdeb\wintoolsdeb\wintoolsdeb.cpp(50): error C2664: 'LSTATUS RegOpenKeyW(HKEY,LPCWSTR,PHKEY)' : cannot convert argument 2 from 'const char [46]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\michal\desktop\etapy\wintoolsdeb\wintoolsdeb\wintoolsdeb.cpp(51): error C2664: 'LSTATUS RegSetValueExW(HKEY,LPCWSTR,DWORD,DWORD,const BYTE *,DWORD)' : cannot convert argument 2 from 'const char [11]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========