| 56 | } |
| 57 | |
| 58 | static std::wstring GetShellPropStringFromPath(LPCWSTR pPath, PROPERTYKEY const& key) |
| 59 | { |
| 60 | try |
| 61 | { |
| 62 | // Use CComPtr to automatically release the IShellItem2 interface when the function returns |
| 63 | // or an exception is thrown. |
| 64 | winrt::com_ptr<IShellItem2> pItem = CreateItemFromParsingName<IShellItem2>(pPath); |
| 65 | |
| 66 | // Use CComHeapPtr to automatically release the string allocated by the shell when the function returns |
| 67 | // or an exception is thrown (calls CoTaskMemFree). |
| 68 | CComHeapPtr<WCHAR> pValue; |
| 69 | winrt::check_hresult(pItem->GetString(key, &pValue)); |
| 70 | |
| 71 | // Copy to wstring for convenience |
| 72 | return std::wstring(pValue); |
| 73 | } |
| 74 | catch (...) {} |
| 75 | return {}; |
| 76 | } |
| 77 | |
| 78 | winrt::Windows::Foundation::Collections::IVector<winrt::Windows::Foundation::IInspectable> FileInfoViewModel::tooltipInfo() |
| 79 | { |