MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / CreateLinkToFile

Method CreateLinkToFile

Explorer++/Helper/FileOperations.cpp:608–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608HRESULT NFileOperations::CreateLinkToFile(const std::wstring &strTargetFilename,
609 const std::wstring &strLinkFilename, const std::wstring &strLinkDescription)
610{
611 IShellLink *pShellLink = NULL;
612 HRESULT hr =
613 CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pShellLink));
614
615 if (SUCCEEDED(hr))
616 {
617 pShellLink->SetPath(strTargetFilename.c_str());
618 pShellLink->SetDescription(strLinkDescription.c_str());
619
620 IPersistFile *pPersistFile = NULL;
621 hr = pShellLink->QueryInterface(IID_PPV_ARGS(&pPersistFile));
622
623 if (SUCCEEDED(hr))
624 {
625 pPersistFile->Save(strLinkFilename.c_str(), TRUE);
626 pPersistFile->Release();
627 }
628
629 pShellLink->Release();
630 }
631
632 return hr;
633}
634
635HRESULT NFileOperations::ResolveLink(
636 HWND hwnd, DWORD fFlags, const TCHAR *szLinkFilename, TCHAR *szResolvedPath, int nBufferSize)

Callers

nothing calls this directly

Calls 4

c_strMethod · 0.80
QueryInterfaceMethod · 0.45
SaveMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected