简单明了实用最好,好象有好几种方法

解决方案 »

  1.   

    将应用程序写到startup目录下,最简单
      

  2.   

    static LPCTSTR gszAppRegKey = TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
    #define  SERVICE_NAME   TEXT("myautorunservice")
    if( RegOpenKeyEx (HKEY_LOCAL_MACHINE,
    gszAppRegKey,
    0,
    KEY_QUERY_VALUE | KEY_SET_VALUE,
    &hKey ) != ERROR_SUCCESS )
    {
     if( RegCreateKey(  HKEY_LOCAL_MACHINE,
    gszAppRegKey,
    &hKey ) != ERROR_SUCCESS )
    {
    return FALSE;
    }
    }
      

  3.   

    startup,在哪里,系统有的是2000,有的是98
      

  4.   

    startup目录是可以通过系统的调用得到的,无论什么操作系统都可以通过这个函数得到GetSystemDirectory()具体内容请看MSDN