如何创建一个程序的快捷方式?如何把一个程序的快捷方式加到启动组里??

dongdongdong 2001-03-16 05:09:00
我只知道用SHGetSpecialFolderLocation可以得到启动组的路经。
...全文
108 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dongdongdong 2001-03-17
  • 打赏
  • 举报
回复
谢谢了,分已经给出。
holyfire 2001-03-16
  • 打赏
  • 举报
回复
IShellLink* pLink;
IPersistFile* pPersistFile;
LPMALLOC ShellMalloc;
LPITEMIDLIST StartUpPidl;
char StartUpDir[MAX_PATH];

if(FAILED(SHGetMalloc(&ShellMalloc)))
return;

if(FAILED(SHGetSpecialFolderLocation(NULL,
CSIDL_STARTUP,
&StartUpPidl)))
return;

if(!SHGetPathFromIDList(StartUpPidl, StartUpDir))
{
ShellMalloc->Free(StartUpPidl);
ShellMalloc->Release();
return;
}

ShellMalloc->Free(StartUpPidl);
ShellMalloc->Release();

if(SUCCEEDED(CoInitialize(NULL)))
{
if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER,
IID_IShellLink, (void **) &pLink)))
{
pLink->SetPath("c:\\yourpath");
pLink->SetDescription("This is your shortcut");
pLink->SetShowCmd(SW_SHOW);

if(SUCCEEDED(pLink->QueryInterface(IID_IPersistFile,
(void **)&pPersistFile)))
{

WideString strShortCutLocation(StartUpDir);
strShortCutLocation += "\\your.lnk";
pPersistFile->Save(strShortCutLocation.c_bstr(), TRUE);
pPersistFile->Release();
}
pLink->Release();
}
CoUninitialize();
}

70,036

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧