Re: Running IShellLinks

Erik Christiansson <erik-s6kU+W+01SO1Z/[email protected]> Tue, 01 Mar 2005 20:58:24 +0100
Newsgroups gmane.comp.windows.shell-shocked.devel
Message-ID <[email protected]>
I would use IContextMenu::InvokeCommand. IIRC I used that with my 
IconDesk module to avoid problems with files types where "open" was not 
the default action. I guess that is not relevant to .lnk files, but it 
takes care of a bunch of problems.

Erik (aka Sci)

ilmcuts wrote:

> Hey all,
>
> I have written a few functions which read and register the hotkeys 
> that .lnk files allow you to specify. Basically the program gets the 
> IShellFolder of the specified root and enumerates all of its elements. 
> Whenever it encounters a link, it gets its IShellLink interface and 
> asks for its hotkey. If it exists it is registered.
>
> The question is, how should the link be invoked later on? Should the 
> IShellLink be stored, or maybe the PIDL? Currently I use a function 
> which does the following:
>
>     SHELLEXECUTEINFO sei = { 0 };
>     sei.cbSize = sizeof(sei);
>     sei.fMask = SEE_MASK_IDLIST;
>     sei.lpIDList = pidl;
>     sei.lpVerb = _T("open");
>     sei.nShow = SW_SHOWNORMAL;
>
>     ShellExecuteEx(&sei);
>
> It obviously uses the PIDL. It works but still has a few drawbacks. 
> For example, it doesn't set sei.dwHotkey appropriately. SW_SHOWNORMAL 
> isn't right either, it should use IShellLink::GetShowCmd.
>
> Do I have to get all that from IShellLink, or is there a function 
> which encapsulates that? In short, is there a function to execute 
> IShellLinks? Is ShellExecuteEx the way to go? Or what about 
> IContextMenu::InvokeCommand? I want a function which uses all of the 
> information IShellLink provides to launch the application that is 
> linked to.
>
> ilmcuts
>
> __________________________________________________
> Subscription options and archive:
> http://www.freelists.org/list/shell-coding
>



__________________________________________________
Subscription options and archive:
http://www.freelists.org/list/shell-coding