资 源 简 介
怎样获取快捷方式所指向的目标文件名? HRESULT hres IShellLink* psl HRESULT hres IShellLink* psl char szGotPath[MAX_PATH] char szDescription[MAX_PATH] WIN32_FIND_DATA wfd OleInitialize(0) hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl) if (SUCCEEDED(hres)) { IPersistFile* ppf hres = psl->QueryInterface(IID_IPersistFile, (void**)&ppf) if (SUCCEEDED(hres)) { WCHAR wsz[MAX_PATH] char lpszLinkFile[MAX_PATH] //这里存放的是快捷方式的路径 if(MultiByteToWideChar(CP_ACP, 0, lpszLinkFile, -1, wsz, MAX_PATH)==0) return hres = ppf->Load(wsz, STGM_READ) if (SUCCEEDED(hres)) { hres = psl->Resolve(m_hWnd, 0) if (SUCCEEDED(hres)) { hres = psl->GetPath(szGotPath, MAX_PATH, (WIN32_FIND_DATA*)&wfd, SLGP_SHORTPATH)-Get the path file of the Shortcut, using IShellLink.