怎样让自己写的程序随系统的启动而运行 是要修改注册表吧,请问哪位高手可以给出详细点的代码来参考吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以用TRegistry类写入注册表的HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run也可以放到开始菜单的启动中去还可以做成服务 写到注册表的Run下面的时候,怎样取得当前程序的路径? 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); }} ExtractFileDir(Application.Exename)ExtractFilePath(Application.Exename) var mypath:string;mypath:=extractfilepath(paramstr(0)); 把可执行文件放到管启动的那个文件夹里.C:\Documents and Settings\All Users\「开始」菜单\程序\启动 注册表中 RUN下面创建一个东西啊。 Delphi中关于DLL窗体方式的提问,请各位大大解答下,谢谢! fastreport控件与tfrPreview控件 帮忙看下这个xml怎么读? 如何获取win2000(xp,2003)的用户名? 搞了大半年ado+access,现在想转到用interbase数据库,想问几个基础性的问题? 求助:关于两个form的更新问题 大虾指教: 怎么实现这样的屏幕效果 急急!!! 请教,急! 能否提供些,好书(数据库方面),好的学习DELPHI的网站 学DELPHI到哪去找源程序呢,??VC的就很多 操作另一个Form的对象时, 内存溢出. 请教如何解决 调用问题(菜)
也可以放到开始菜单的启动中去
还可以做成服务
{
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);
}
}
ExtractFilePath(Application.Exename)
mypath:=extractfilepath(paramstr(0));
C:\Documents and Settings\All Users\「开始」菜单\程序\启动