How to show shell hint (text that appears when hovering a file in Explorer) for a file programmatically

StackOverflow https://stackoverflow.com/questions/18096749

  •  23-06-2022
  •  | 
  •  

Question

This is what I want to get:

enter image description here

I know it's possible to get because Total Commander shows exactly the same info, although in a differently styled window. Which makes me think that there must be a way of querying this text for any given file.

Was it helpful?

Solution

The IQueryInfo interface is what you want. Briefly (psuedo-code only, sorry):

PCUITEMID_CHILD pidl = <PIDL of item in question>
IShellFolder* psf = <IShellFolder parent folder of item in question>

IQueryInfo* pqi;
if (SUCCEEDED(psf->GetUIObjectOf(hWnd, 1, &pidl, 0, &pqi)))
{
    LPWSTR lpszTip;
    if (SUCCEEDED(pqi->GetInfoTip(0, &lpszTip)) && lpszTip)
    {
        // do something with the tip, and then free it
        CoTaskMemFree(lpszTip); 
    }
}

Once you have the text you can, of course, display it any way you like.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top