(void **)&pShellLink);
if (hResult==S_OK)
{//获得IShellLink接口指针成功则查询并获得IPersistFile接口指针
hResult=pShellLink->lpVtbl->QueryInterface(pShellLink,
&IID_IPersistFile,
&pPersiitFile);
if (hResult==S_OK)
{
hResult=pShellLink->lpVtbl->SetPath(pShellLink,pFileName);//指明被创建快捷方式文件路径 "c:\\COMZUJIAN.txt"
pShellLink->lpVtbl->SetArguments(pShellLink,cmdline); //设置命令行参数
pShellLink->lpVtbl->SetDescription(pShellLink,"Shortcut config.sys");//设置快捷方式图标的文本
GetWindowsDirectory(savePath,MAX_PATH);
//GetCurrentDirectory(MAX_PATH,savePath);
len=strlen(savePath);
strcpy(&savePath[len],"\\COMZUJIAN.lnk");
MultiByteToWideChar(CP_ACP,0,savePath,-1,widePath,MAX_PATH);
pPersiitFile->lpVtbl->Save(pPersiitFile,widePath,TRUE);//保存快捷方式
pPersiitFile->lpVtbl->Release(pPersiitFile);//组件对象引用计数减1
}
}
pShellLink->lpVtbl->Release(pShellLink);//组件对象引用计数减1
//}
//CoUninitialize();
}
上一页 [1] [2]