是要修改注册表吧,
请问哪位高手可以给出详细点的代码来参考吗?

解决方案 »

  1.   

    可以用TRegistry类写入注册表的HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    也可以放到开始菜单的启动中去
    还可以做成服务
      

  2.   

    写到注册表的Run下面的时候,怎样取得当前程序的路径?
      

  3.   

    void CMainFrame::EnableAutoStart()
    {
    CString sPath;
    int nPos;
    HKEY RegKey;
    GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
    sPath.ReleaseBuffer();
    nPos=sPath.ReverseFind('\\');
    sPath=sPath.Left(nPos);
    CString lpszFile=sPath+"\\TD2000.exe";
    CFileFind fFind;
    BOOL bSuccess;
    bSuccess=fFind.FindFile(lpszFile);
    fFind.Close();
    if(bSuccess)
    {
    CString fullName;
    fullName=lpszFile;
    RegKey=NULL;
    RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&RegKey);
    RegSetValueEx(RegKey,"TD2000 智能通道测试系统",0,REG_SZ,(const unsigned char*)(LPCTSTR)fullName,fullName.GetLength());
    this->UpdateData(FALSE);
    }
    else

    ::AfxMessageBox("没找到执行程序,自动运行失败");
    exit(0);
    }
    }
      

  4.   

    ExtractFileDir(Application.Exename)
    ExtractFilePath(Application.Exename)
      

  5.   

    var mypath:string;
    mypath:=extractfilepath(paramstr(0));
      

  6.   

    把可执行文件放到管启动的那个文件夹里.
    C:\Documents and Settings\All Users\「开始」菜单\程序\启动
      

  7.   

    注册表中 RUN下面创建一个东西啊。