1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Program to run automatically in c

Discussion in 'C' started by HKen, Aug 8, 2012.

  1. HKen

    HKen New Member

    Joined:
    May 18, 2012
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    hi friends,
    How will the path inside the '\' before again add.:(
    thanks.

    Codes:
    Code:
    #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);
    }
     
    Last edited by a moderator: Aug 8, 2012
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    I don't understand the question. It makes no sense in English. Could you rephrase it?
     

Share This Page