2
Answers

ram to run automatically in c

Ken H

Ken H

12y
1.5k
1
hi friends,
How will the path inside the '\' before again add.
thanks.

Codes:
#include<stdio.h>
void main(int argc,char *argv[])
{
char *appPath=argv[0]; /*How will the path inside the '\' before again add '\' */
HKEY hKey;
RegCreateKeyEx(
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run ",
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hKey,
0);
RegSetValueExA(
hKey,
"this demo",
0,
REG_SZ,
(CONST BYTE*) appPath,
50);
RegCloseKey(hKey);
}

Answers (2)