Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is IShellExecuteHook not supported in Vista?

287 views
Skip to first unread message

Jon Potter

unread,
Jan 23, 2007, 5:46:49 PM1/23/07
to
Hi,
I can't find any mention of this anywhere but I'm starting to assume that
IShellExecuteHook is not supported in Vista. I can't get my hook to be
called or even instantiated at all. Are there new procedures for registering
a shell execute hook in Vista or has this feature been quietly dropped?

Cheers,
Jon

Walter Wang [MSFT]

unread,
Jan 24, 2007, 4:42:00 AM1/24/07
to
Hi Jon,

Previously we've encountered many app compatibility problems regarding this
interface, therefore it's currently disabled by default on Vista with a
policy control:

You can turn it on by enabling POLID_EnableShellExecuteHooks. Set this
under
[HKLM|HKCU]\Softwaren\Microsoft\Windows\CurrentVersion\Policies\Explorer
EnableShellExecuteHooks=<DWORD>1.

After that, you still need to add the CLSID under

HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\ShellExecuteHooks

The MSDN documentation is being scheduled to update this new information
there.

In the meanwhile, we would be interested to know why you're relying on this
feature, there might be some other approach for your purpose.

Sincerely,
Walter Wang (waw...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jon Potter

unread,
Jan 24, 2007, 7:01:07 PM1/24/07
to
Hi Walter, thanks for your fast response!

"Walter Wang [MSFT]" <waw...@online.microsoft.com> wrote in message
news:Lc$cj45PH...@TK2MSFTNGHUB02.phx.gbl...


> You can turn it on by enabling POLID_EnableShellExecuteHooks. Set this
> under
> [HKLM|HKCU]\Softwaren\Microsoft\Windows\CurrentVersion\Policies\Explorer
> EnableShellExecuteHooks=<DWORD>1.

Thanks for that info.

> In the meanwhile, we would be interested to know why you're relying on
> this
> feature, there might be some other approach for your purpose.

We make a file manager that offers the option to act as an
Explorer-replacement for browsing folders. Since Microsoft haven't provided
a simple way for the user to specify the default Folder browser like they
have for the web (via the Default Programs interface), trapping calls to
ShellExecute that invoke explorer.exe becomes necessary.

If you can suggest a better way of doing this I'd be happy to hear it :)

Regards,
Jonathan Potter

Walter Wang [MSFT]

unread,
Jan 24, 2007, 9:47:26 PM1/24/07
to
Hi Jon,

What is calling ShellExecute(explorer.exe)? Is this through explorer's file
association, the 'open' verb on folders which winds up calling back into
explorer.exe? The default folder browser provided by explorer.exe works in
tandem with ShellExecute, the verbs associated with items, and the file
associations system. The components were not designed to work without each
other.

Regards,


Walter Wang (waw...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

Jon Potter

unread,
Jan 25, 2007, 12:50:59 AM1/25/07
to
Hi Walter,

The problem is that the 'open' verb on Folders can't be overridden without
admin/elevated permissions. Creating an 'open' verb in
HKEY_CURRENT_USER\Software\Classes _should_ work but doesn't - Explorer
ignores this and keeps using the 'open' verb from HKEY_LOCAL_MACHINE.

What we do is create our own verb under HKEY_CURRENT_USER, and set that as
the default action. For the most part this works ok, except when
ShellExecute() is called for a folder with the verb actually specified as
"open" instead of NULL for the default. In these instances, it is necessary
to use a ShellExecute hook to trap it.

Perhaps you could find out why Explorer ignores the 'open' verb from
HKEY_CURRENT_USER? According to the docs, "If the values of entries in the
two Classes subkeys conflict, then only the value in
HKEY_CURRENT_USER\SOFTWARE\Classes appears in HKEY_CLASSES_ROOT.", so (imho)
you could say this is a bug.

Cheers,
Jon

"Walter Wang [MSFT]" <waw...@online.microsoft.com> wrote in message

news:jxIuvsCQ...@TK2MSFTNGHUB02.phx.gbl...

Walter Wang [MSFT]

unread,
Jan 25, 2007, 2:18:30 AM1/25/07
to
Hi Jon,

Regarding the explorer ignores 'open' verb from HKCU, is this only on
Vista? Does this occur when the process is ran elevated?

Jon Potter

unread,
Jan 25, 2007, 3:27:52 AM1/25/07
to
Hi Walter,

It happens in XP too, and elevation under Vista would seem to make no
difference.

Cheers,
Jon

"Walter Wang [MSFT]" <waw...@online.microsoft.com> wrote in message

news:H7%23HhdFQ...@TK2MSFTNGHUB02.phx.gbl...

Walter Wang [MSFT]

unread,
Jan 25, 2007, 10:03:54 PM1/25/07
to
Hi Jon,

Let me get one thing clear: are you replacing the shell or not using the
registry (http://www.pctools.com/guides/registry/detail/849/)?

I'm still discussing some possible alternate approach with my colleagues
for your requirement. I'll get back to you later.

Jon Potter

unread,
Jan 26, 2007, 12:47:28 AM1/26/07
to
Hi Walter,

No we're not replacing the shell. Explorer still runs as the desktop (and as
a separate window if it is started specifically by the user choosing
'Explore' from a folder context menu). We just want our program to come up
whenever the user double-clicks a folder.

Cheers,
Jon

"Walter Wang [MSFT]" <waw...@online.microsoft.com> wrote in message

news:NJTPyVQQ...@TK2MSFTNGHUB02.phx.gbl...

Paul Baker [MVP, Windows - Networking]

unread,
Jan 26, 2007, 9:40:27 AM1/26/07
to
Maybe you can override the "open" verb or change the default menu item by
using another kind of shell extension like a context menu handler? I am not
sure.

Paul

"Jon Potter" <gps...@nospam.nospam> wrote in message
news:uB1uy1QQ...@TK2MSFTNGP03.phx.gbl...

Jim Barry

unread,
Jan 26, 2007, 11:10:32 AM1/26/07
to
Paul Baker [MVP, Windows - Networking] wrote:
> Maybe you can override the "open" verb or change the default menu
> item by using another kind of shell extension like a context menu
> handler?

Hmmm, a context menu handler can set the default item and also the double-click action provided that it is registered with the MayChangeDefaultMenu subkey, though I don't think it can override the "open" verb because the shell removes items with duplicate verbs.

--
Jim Barry, MVP (Windows SDK)

Paul Baker [MVP, Windows - Networking]

unread,
Jan 26, 2007, 11:55:03 AM1/26/07
to
Jim,

I see now that the default verb maybe be "explore", not "open", at least on
Windows XP, depending on whether or not the Folder Bar is visible.

Can Jon replace the HCKR\Folder\open and/or HCKR\Folder\explore key and if
so, is that a good idea?

Maybe changing the default menu item will work. Jon said he wants to be
called when the user double-clicks a folder.

Paul

"Jim Barry" <j...@mvps.org> wrote in message
news:OsbrCSWQ...@TK2MSFTNGP04.phx.gbl...

Jim Barry

unread,
Jan 26, 2007, 12:54:14 PM1/26/07
to
Paul Baker [MVP, Windows - Networking] wrote:
> I see now that the default verb maybe be "explore", not "open", at
> least on Windows XP, depending on whether or not the Folder Bar is
> visible.

Also according to the default value under HKCR\Folder\shell :-)

> Can Jon replace the HCKR\Folder\open and/or HCKR\Folder\explore key
> and if so, is that a good idea?

I don't think it will work properly because the shell does some weird and wonderful stuff for "open" and "explore".

Jon Potter

unread,
Jan 26, 2007, 3:46:06 PM1/26/07
to
Hi Paul,

"Paul Baker [MVP, Windows - Networking]" <paulrich...@community.nospam>
wrote in message news:OV1J6qWQ...@TK2MSFTNGP03.phx.gbl...


> Can Jon replace the HCKR\Folder\open and/or HCKR\Folder\explore key and if
> so, is that a good idea?

Unfortunately doing that requires admin permission (or elevation under
Vista), and we want this to be an option that is available to standard users
as well.

Cheers,
Jon

Paul Baker [MVP, Windows - Networking]

unread,
Jan 26, 2007, 4:49:45 PM1/26/07
to
Jon,

Why does it require an administrator? Certainly, it requires an
administrator to change those registry entries, but after that anyone should
be able to use them.

I added the following registry entries on my Windows XP Service Pack 2
machine, and it had the effect I believe you are looking for:

HKCR\Folder\shell\(default)=test
HKCR\Folder\shell\test\command\(default)=Notepad.exe

It makes "test" the default verb and so double-clicking on a folder in a
shell view opens Notepad.

Unfortunately, so does clicking a folder menu item in the Start Menu, such
as My Computer or My Pictures.

You can presumably achieve a similar thing with more control using a context
menu handler.

Paul

"Jon Potter" <gps...@nospam.nospam> wrote in message

news:u0Ng7rYQ...@TK2MSFTNGP06.phx.gbl...

Jim Barry

unread,
Jan 26, 2007, 5:15:17 PM1/26/07
to
Jon Potter wrote:
> Unfortunately doing that requires admin permission (or elevation under
> Vista), and we want this to be an option that is available to
> standard users as well.

Does the merged view of HKEY_CLASSES_ROOT help your situation?

http://msdn2.microsoft.com/en-us/library/ms724498.aspx

Walter Wang [MSFT]

unread,
Jan 27, 2007, 12:31:44 AM1/27/07
to
Hi Jon,

We have a workaround on Vista:

=======================
REGEDIT4

[HKEY_CURRENT_USER\Software\Classes\Folder]
@=""

[HKEY_CURRENT_USER\Software\Classes\Folder\shell]

[HKEY_CURRENT_USER\Software\Classes\Folder\shell\open]

[HKEY_CURRENT_USER\Software\Classes\Folder\shell\open\command]
@="c:\\windows\\system32\\cmd.exe /k echo %L"
"DelegateExecute"=""
=======================

After merged above registry values, the verb 'open' on Folders will execute
cmd.exe and echo the location. HOWEVER, this workaround has two caveats:

1) All shell namespace extensions will also be handled by your program,
such as Network Center, Control Panel Category View, GAC Viewer, and other
third party IShellFolder implementations. If your program doesn't support
that, users of your program may be confused by the behavior.

2) This will not work on future versions of Windows.

Jon Potter

unread,
Jan 27, 2007, 12:38:16 AM1/27/07
to
Thanks Walter! I will give this a try.
Is "DelegateExecute" the key to this workaround? I have noticed this value
before but never been able to find any description of it.

Cheers,
Jon

"Walter Wang [MSFT]" <waw...@online.microsoft.com> wrote in message

news:gfCizRd...@TK2MSFTNGHUB02.phx.gbl...

Walter Wang [MSFT]

unread,
Jan 28, 2007, 10:31:26 PM1/28/07
to
Hello Jon,

I cannot find your valid email address, if it's ok, would you please email
me privately? Thanks.

Jim Barry

unread,
Jan 29, 2007, 3:53:09 PM1/29/07
to
Walter Wang [MSFT] wrote:
> Hello Jon,
>
> I cannot find your valid email address, if it's ok, would you please
> email me privately? Thanks.

Hey Walter, can we keep it on the newsgroup please?

Walter Wang [MSFT]

unread,
Jan 30, 2007, 9:57:28 PM1/30/07
to
Hi all,

The DelegateExecute registry value is internal in Vista, therefore previous
workaround is not recommended.

I've been discussing this question in our internal discussion list with
shell team. The IShellExecuteHook interface is considered deprecated in
Vista (the MSDN documentation will be updated soon).

During the discussion, so far the best workaround is to add a new verb to
folders, "open with app foo" and make it the default. That way user can
still right-click "open" to open with explorer. This can be done via static
registration of a verb using IDropTarget, command line or DDE (preferred in
this order).
(http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersg
uide/shell_basics/shell_basics_extending/fileassociations/fa_verbs.asp?frame
=true, see section "How the Shell Invokes Verbs").

Paul Baker [MVP, Windows - Networking]

unread,
Jan 31, 2007, 9:23:09 AM1/31/07
to
Thanks Walter,

I do think this is a good solution. I, as the user, would not want "open" to
be entirely overriden anyway.

Paul

"Walter Wang [MSFT]" <waw...@online.microsoft.com> wrote in message

news:QIqaPOOR...@TK2MSFTNGHUB02.phx.gbl...

Papitha

unread,
Apr 20, 2007, 2:32:27 AM4/20/07
to
Hi friends,
I have a requirement to monitor all the files and folders which are opened and log the details of the same and store in my database. I do not override any normal behaviour of the shell but just would like to get notified whenever any shell item is opened.
I use IShellExecuteHook to achieve the same. Unfortunately my application does not works as desired in Windows Vista.
I understand that the API is depricated in Windows Vista. I would be very grateful if anyone can suggest me a good alternative?

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com

Papitha

unread,
Apr 20, 2007, 2:40:27 AM4/20/07
to

Papitha

unread,
Apr 20, 2007, 2:40:34 AM4/20/07
to

Papitha

unread,
Apr 20, 2007, 2:40:29 AM4/20/07
to

Papitha

unread,
Apr 20, 2007, 2:41:21 AM4/20/07
to

Papitha

unread,
Apr 20, 2007, 2:48:04 AM4/20/07
to
Sorry to have mistakenly submitted my question more than once. that just shows how desparate iam to get an answer ;-)

Gautam Jain

unread,
Apr 21, 2007, 1:29:26 AM4/21/07
to
Hi Papitha,

I am in the same situation and was looking for a solution here at the forums
(See my posts on 9th and 6th April).

Unfortunately no body has replied :( :(

If you find a solution, please do email me. Please. I will do the same.

--

Regards,
Gautam Jain

<Papitha> wrote in message
news:200742024026pa...@lntinfotech.com...

imhere

unread,
May 21, 2007, 9:16:40 PM5/21/07
to
Hi, Papitha and Gautam.

I was so pleased after finding your post. I have same trouble with
you..

Actually, I'm monitoring and logging the history of processes executed
in Windows, but, it's not working in Vista.

If you find the answer, please e-mail me :) It would be sooo helpful
to me. Thank u.


kbman

unread,
Sep 27, 2007, 4:55:07 AM9/27/07
to
Does any guys has verified this solution? I followed but it didn't work.
0 new messages