bool GetFileList(std::string path)
{
path += "\\*";
CFileFind finder;
BOOL working = finder.FindFile(path.c_str());
while (working)
{
working = finder.FindNextFile();
if (!finder.IsDirectory() && !finder.IsDots())
{
if(finder.GetFileName() == "test.lnk")
return true;
}
}
return false;
}
bool findLink()
{
char Path[MAX_PATH+1];
std::string strDestDir;
LPITEMIDLIST pidl;
LPMALLOC pShell;
if(SUCCEEDED(SHGetMalloc(&pShell)))
{
if(SUCCEEDED(SHGetSpecialFolderLocation(NULL,CSIDL_DESKTOPDIRECTORY,&pidl)))
{
if(!SHGetPathFromIDList(pidl,Path))
{
pShell->Free(pidl);
}
pShell->Release();
strDestDir = Path;
return GetFileList(strDestDir);
}
}
return false;
}
bool CreateLink2Desktop()
{
HRESULT hr = CoInitialize(NULL);
if (SUCCEEDED(hr))
{
IShellLink *pisl;
hr = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pisl);
i
c++查找桌面快捷方式,没有就创建
最新推荐文章于 2024-01-23 22:18:24 发布