tags:

views:

31

answers:

1

Hi,

I have created a COM DLL to apply Overlay icon for file/folders.

If I open a folder, IsMemberOf() function has been called for each files. And I can determine whether icon to be set for the particular file by querying the db at run time based on file status. (I will update the file status in db say modified/added similar things)

Seems, it is costlier and very slow to query for each files in a directory. Hence I decide to query for the first file (get all the files status from db in the directory and store in memory) and by using that will process the remaining list of files.

For that, I want to know whether all the files are processed completely in IsMemberof function. Once all the files are processed, I can clean the memory. And if the explorer refreshes again, I can query the db once again for file status.

Is there a way to determine all the files are processed in IsMemberof function. Or is there any other way to do it simply.

Thanks,

+1  A: 

I'll guess that you are actually talking about a shell extension handler and the IShellIconOverlayIdentifier interface.

Yes, the IsMemberOf method will be called frequently. You have to keep it snappy or the user will experience poor behavior in Explorer if your code needs a lot of time to query a dbase. No, you cannot assume that the next call will pass a path to points to the same folder as the previous one, merely that it is likely to do so.

To flush your cache, you probably get reasonable behavior if you see that the folder name has changed from the previous call. Another strategy is to keep track of the age of the cached item. Throw out old ones when the cache fills up. This will help when the user switches back and forth between folders, not an uncommon operation.

Hans Passant