Shell Extensions?

In Vista Beta 1 our shell extensions worked but in beta 2 Build 5384 it no longer works. I found some mention of

Like all COM objects, Shell extension handlers must implement anIUnknown interface and aclass factory. Most must also implement either anIPersistFile orIShellExtInit interface in Windows XP or earlier. These were replaced byIInitializeWithStream,IInitializeWithItem andIInitializeWithFile in Windows Vista. The Shell uses these interfaces to initialize the handler.

In some msdn documentation but I can't find any samples. Anyone have any information? Thanks.

[2523 byte] By [shsu] at [2008-2-19]
# 1

what type of extension are you creating?

these docs refer to property handlers, perview handlers and thumbnail providers.

Chris

Chris_Guzak at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 2
My extensions deal with property handlers and icon handlers.

Thanks.

later

shsu at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 3

icon handlers (that implement IExtractIcon) are initalized like they were in XP using IPersistFile. you should see IPersistFile::Load() being called.

property handlers (that implement IPropertyStore) are new for Vista and should implemented IInitalizeWithStream.

one change we made in Vista is we always create your handler on the cannonical interface of the handler type. that means you are created with IExtractIcon or IPropertyStore rather than on some other face initially. if your COM object implements its QI properly this should not be a problem.

Chris

Chris_Guzak at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 4

Hello All,

I have an application which creates Context menu handlers(implement IShellExtInit and IContextMenu) .These do not work on Windows Beta build as mentioned .The QueryInterface is never invoked with REFIID of IShellExtInit() as it used to be earlier . Any help is appreciated .

vinitas at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 5

Whatever was the problem seems to be fixed in RC2. With no code changes my extensions are working again. I'll have to test further but the context menu's and also the Desktop Icons are behaving properly again.

shsu at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 6
There seems to be some difference between the 32 bit version and 64 bit version of Vista. My shell extension works on the 32 bit version but not on the 64 bit version. Any ideas on where to look? Thanks.
shsu at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 7
Did you recompile your shell extension as 64-bit?
RaymondChen-MSFT at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 8

We've just done that before we got your post, seems obvious now, but not really. Vista 64 won't load 32 bit shell extensions?

Also, now that we've done that it still doesn't work. Seems to be a problem with inserting the CLSID into the

Software\Microsoft\Windows\CurrentVersion\ShellExtensions\Approved\

Key. Is there a way to insert this manually? I've tried using regedit, but it always says the keys in use by the

system. Our installer is an MSI installer but it routes the key to

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node

Thanks.

later

shsu at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 9
I had seen an msdn documentation which reports the change of header file for IConTextMenu interface from shlobj.h to shobjidl.h.Do I need to recomplie my app including this new file.Also as I had mentioned the IShellExtInit interface is never passed to my application .As by the post above "one change we made in Vista is we always create your handler on the cannonical interface of the handler type. that means you are created with IExtractIcon or IPropertyStore rather than on some other face initially. if your COM object implements its QI properly this should not be a problem." does it implies that for context menu handlers the first interface we can expect is IContextMenu and not IShellExtInit...
vinitas at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 10
If you wrote your context menu correctly, none of the Vista changes should affect you. The Vista changes only affect people who wrote their extensions incorrectly. The IID is still the same, and if you respond to CreateInstance and QI correctly you will still get the same interfaces (perhaps in a different order).
RaymondChen-MSFT at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 11

Hi Raymond ,

Just want to clarify that CreateInstance never gets invoked with a REFIID of IID_IShellExtInit on Vista OS .Here when you say that the orders are different I assume that the both the interfaces of IShellExtInit and IContextMenu should be initialized by the shell at some point but this is not the case....IShellExtInit interface is never received and we are always left with IContextmenu..is this something expected in event of vista changes?

vinitas at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 12
I believe that the new model is that you get a CreateInstance for IContextMenu and then a QI for IShellExtInit. But you should support either direction - COM rules require it.
RaymondChen-MSFT at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 13

Hi,

Apologies if this is off-topic; I'm trying to write a thumbnail provider in Vista, which I believe is a type of shell extension.

Going by the ThumbnailProvider example, I have a handler that implements QueryInterface as follows:

IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(CMyThumbHandler, IInitializeWithStream),
QITABENT(CMyThumbHandler, IThumbnailProvider),
{ 0 },
};

return QISearch(this, qit, riid, ppv);

}

This is strictly taken from the sample - but the call to QISearch will return a failing HR. Is there another interface that I need to implement? Judging by this thread, it sounds like there might be.

Not sure if this is relevant, but I did a call to StringFromIID with the incoming riid and the result was: 9B45E435-34A9-4E6B-A2A1-B0ECD284967C. I could not find that IID anywhere on my system, and it does not seem to correspond to any of the interfaces mentioned on this thread.

Any help would be greatly appreciated.

Thanks!

Eric.

EricLee at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...
# 14

I ended up getting this working, what I ended up doing is I created a new ATL-based COM project and added my own implementation of a thumbnail provider - borrowing from the sample where I could. For some reason, my implementation worked just fine! I hand-checked how I registered my sample and it seems OK, but for whatever reason it just wouldn't work for me.

In any case, I put the sample I created based on that platform sdk sample on my blog.

Thanks!

Eric.

EricLee at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Search, Organize and Visualize in Windows Vista...

Software Development for Windows Vista

Site Classified