PRB: GIL_DONTCACHE Causes Incorrect Icon to Display in Namespace Extension |
Q214599
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), on platform(s):
- Microsoft Windows 95
- Microsoft Windows 98
- Microsoft Windows NT Server version 4.0
- Microsoft Windows NT Workstation version 4.0
- the operating system: Microsoft Windows 2000
SYMPTOMS
Shell namespace extensions can have different icons for the various shell folders. These icons are displayed in both the tree view and the address bar of Microsoft Windows Explorer.
If the icon handler for a shell folder returns GIL_DONTCACHE as one of the bit flags for the last parameter in the implementation of the IExtractIcon::GetIconLocation function, the icons for the shell namespace extension folder may appear to be random icons.
CAUSE
This problem can occur when the GIL_DONTCACHE flag is set in IExtractIcon::GetIconLocation, without specifying both the szIconFile and piIndex parameters.
RESOLUTION
To force the shell to not cache the icons, and instead to ask the namespace extension for the appropriate icons, do not specify the GIL_DONTCACHE flag for the last parameter in the implementation of the IExtractIcon::GetIconLocation function. If the GIL_DONTCACHE flag is set, also set the szIconFile and piIndex parameters.
STATUS
This behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
- Build a nonrooted namespace extension that returns different icons for different shell folders. See the "References" section for more information on how to build a namespace extension.
- Implement the IExtractIcon interface and return the pointer to this interface from IShellFolder::GetUIObjectOf for IID_IExtractIcon.
- In the implementation of IExtractIcon::GetIconLocation, specify GIL_DONTCACHE along with any other flags in the last parameter to the function.
- Build the project and register it.
- Open and refresh the Explorer window. Traverse to the newly added namespace extension.
- Open the root of the namespace extension and select the folders under it.
- Select any other level folder or a different folder, and then reselect the old folder.
Notice that the icon for the newly selected folder may change to a seemingly random one instead of displaying the old icon.
- In the implementation of IExtractIcon::GetIconLocation, remove the GIL_DONTCACHE bit while returning.
- Restart the shell, and then repeat steps 4 to 6.
- Repeat step 7, which results in the correct icon being displayed.
REFERENCES
For additional information on how to build a namespace extension, click the article number below to view the article in the Microsoft Knowledge Base:
Q178665 SAMPLE: RegView.exe Contains Shell Namespace Extension Example
Additional query words:
Keywords : kbIcon kbNameSpace kbShellGrp kbDSupport
Issue type : kbprb
Technology : kbAudDeveloper kbWin32sSearch kbWin32API
Last Reviewed: December 16, 2000 |