开发者

Implement Overlay Icon?

I read this article in http://www.codeproject.com/KB/shell/overlayicon.aspx. I have some questions that I cannot answer. Please help me?

  1. When I build the project to COM dll. When I use other program to call this dll. Which method could I will call to display overlay icon on the selected file? I think I will call GetOverlayInfo() first and call IsMemberOf()? Just 2 functions?
  2. In the GetOverlayInfo(). Will I pass what value in the first parameter? the path of the overlay icon? or the path of the file which will be setted overlay icon on it? Could u give me an example?
  3. In the below function:

    STDMETHODIMP CMyOverlayIcon::GetOverlayInfo(
        LPWSTR pwszIconFile,
        int cchMax,int* pIndex,
        DWORD* pdwFlags)
    {
     GetModuleFileName(_AtlBaseModule.GetModuleInstance(),pwszIconFile,cchMax);
    
     *pIndex =0;
     *pdwFlags = ISIOI_ICONFI开发者_C百科LE | ISIOI_ICONINDEX;
    
     return S_OK;
    }
    

Could u tell me could I pass what value to the function when I call it from outside program. Could u give me an example how to call it and transfer value to it?

  1. pwszIconFile
  2. cchMax
  3. pIndex
  4. pdwFlags (Could I pass which value when I call it from outside. Ex C# program)


  1. Yes, you can get away with just the two functions. But I would call GetPriority() anyway, even if you don't use the return value. You'll never know whether the overlay handler relies on that call or not (if you haven't written it yourself). And you only need to call GetOverlayInfo() once, but IsMemberOf() for every file you want to show the overlay icon for.
  2. You have to pass an (empty) buffer and in cchMax the length of the buffer. The Overlay handler will then fill the buffer with the path of the icon file. But you also have to check the pdwFlags and pIndex (both are filled by the overlay handler too) - depending on the flags set in pdwFlags, you either get a path to an icon file in pwszIconFile or a path to an exe file which contains the icon in its resources. If the latter, then the pIndex value is the resource index of the icon in the exe file you have to load.

You didn't say why you want to call the overlay handlers yourself. If you simply want to show the icons as explorer does in some list view or dialog, you can use a much easier route where you don't need to read the registry where all the overlay handlers are registered (and some of the system overlays aren't even registered there!).

Have a look at KB192055, maybe that's a better way for what you need?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜