|
|
|
date: Thu, 6 Mar 2008 10:41:01 -0800,
group: microsoft.public.platformsdk.shell
back
Re: URL Moniker gets executed?
Ya know, before I spent the last couple months beating my head against
writing an NSE I'd have thought so too, however, by the time you actually get
your head around what is happening in the explorer ( I've stepped through way
too much assembly code) some of this makes a lot of sense.
The description of my problem statement, and the code I've written to get to
this point are probably 99.999 % correct and appropriate. But NSE's are not
well documented when it comes to the very fine points.
--
Gak -
Finecats
"Paul Baker [MVP, Windows - SDK]" wrote:
> I've never tried to write a NSE, but shouldn't you just be delegating to the
> file system interfaces instead of the CDefView? They won't know the
> difference between the file system folder and your folder. Certainly parsing
> the file name for its extension and opening registy keys doesn't sound like
> something that would ensure the right behaviour.
>
> Paul
>
> "usfinecats" <usfinecats@nospam.nospam> wrote in message
> news:B5B5CAA3-AFA7-483B-9F65-2BCF3C4CCCAC@microsoft.com...
> > On XP sp2 in my NSE using CDefView I'm seeing an odd behavior? .
> >
> > My NSE basically shuffles around the names in the normal filesystem.
> > So when a user clicks on an item in my namespace, I want the normal
> > behavior
> > that would be associated with a click on that file in the normal place.
> > E.g.
> >
> > I have MYNameSpace\A folder\Somefile.doc
> > and if the user clicks on it I'd like Word to open say
> > C:\A folder\Somefile.doc.
> >
> > When I build my menus I use CDefFolderMenu_Create2 to get a default menu
> > (say, pDefMenu) and I pass in as one of the keys HKCR\.doc. And when I
> > get
> > called in my IContextMenu::InvokeCommand I delagate this to
> > pDefMenu->InvokeCommand() [this is, the CDefView's implementation].
> >
> > Now the puzzling thing about this is that pDefMenu->InvokeCommand calls
> > ShellExecuteEx which eventually starts calling my
> > IShellFolder::GetDisplayNameOf() routine over and over. But since I know
> > that what's going on here I return to it c:\A folder\Somefile.doc in
> > hopes
> > that CDefView will figure this out and launch Word.exe. But instead of
> > launching Word directly, it thinks that it is dealing with a URLMoniker
> > and
> > imbeds this in the Explorer. ".... Do you want to open this file, do you
> > think its safe, etc" .
> >
> > What do I need to return from GetDisplayNameOf () to get this opened
> > directly in Word as it would it I clicked on the file at C:\A
> > folder\Somefile.doc ?
> >
> >
> >
> > --
> > Gak -
> > Finecats
>
>
>
date: Thu, 6 Mar 2008 16:43:01 -0800
author: usfinecats am
Re: URL Moniker gets executed?
Hmm, sorry I could not be of any help.
"usfinecats" <usfinecats@nospam.nospam> wrote in message
news:A8FB6614-E03F-42D1-9580-9C431CA54A84@microsoft.com...
>
> Ya know, before I spent the last couple months beating my head against
> writing an NSE I'd have thought so too, however, by the time you actually
> get
> your head around what is happening in the explorer ( I've stepped through
> way
> too much assembly code) some of this makes a lot of sense.
>
> The description of my problem statement, and the code I've written to get
> to
> this point are probably 99.999 % correct and appropriate. But NSE's are
> not
> well documented when it comes to the very fine points.
> --
> Gak -
> Finecats
>
>
> "Paul Baker [MVP, Windows - SDK]" wrote:
>
>> I've never tried to write a NSE, but shouldn't you just be delegating to
>> the
>> file system interfaces instead of the CDefView? They won't know the
>> difference between the file system folder and your folder. Certainly
>> parsing
>> the file name for its extension and opening registy keys doesn't sound
>> like
>> something that would ensure the right behaviour.
>>
>> Paul
>>
>> "usfinecats" <usfinecats@nospam.nospam> wrote in message
>> news:B5B5CAA3-AFA7-483B-9F65-2BCF3C4CCCAC@microsoft.com...
>> > On XP sp2 in my NSE using CDefView I'm seeing an odd behavior? .
>> >
>> > My NSE basically shuffles around the names in the normal filesystem.
>> > So when a user clicks on an item in my namespace, I want the normal
>> > behavior
>> > that would be associated with a click on that file in the normal place.
>> > E.g.
>> >
>> > I have MYNameSpace\A folder\Somefile.doc
>> > and if the user clicks on it I'd like Word to open say
>> > C:\A folder\Somefile.doc.
>> >
>> > When I build my menus I use CDefFolderMenu_Create2 to get a default
>> > menu
>> > (say, pDefMenu) and I pass in as one of the keys HKCR\.doc. And when
>> > I
>> > get
>> > called in my IContextMenu::InvokeCommand I delagate this to
>> > pDefMenu->InvokeCommand() [this is, the CDefView's implementation].
>> >
>> > Now the puzzling thing about this is that pDefMenu->InvokeCommand calls
>> > ShellExecuteEx which eventually starts calling my
>> > IShellFolder::GetDisplayNameOf() routine over and over. But since I
>> > know
>> > that what's going on here I return to it c:\A folder\Somefile.doc in
>> > hopes
>> > that CDefView will figure this out and launch Word.exe. But instead
>> > of
>> > launching Word directly, it thinks that it is dealing with a URLMoniker
>> > and
>> > imbeds this in the Explorer. ".... Do you want to open this file, do
>> > you
>> > think its safe, etc" .
>> >
>> > What do I need to return from GetDisplayNameOf () to get this opened
>> > directly in Word as it would it I clicked on the file at C:\A
>> > folder\Somefile.doc ?
>> >
>> >
>> >
>> > --
>> > Gak -
>> > Finecats
>>
>>
>>
date: Fri, 7 Mar 2008 09:24:48 -0500
author: Paul Baker [MVP, Windows - SDK] am
Re: URL Moniker gets executed?
Dave,
I struggled with watching the assembly language execute for a while and saw
that it eventually called ShExecuteEx . Since that API is available, I
decided not to delegate to the CDefView::InvokeCommand and call it directly.
Seems to work.
However, in the simpler case of exercising the default command for a Folder,
I did use CDefView::InvokeCommand and that too works.
I know this sounds like a goofy implementation, both should have worked, but
infact the execution of an item in CDefView is the problem. I watched the
explorer call GetDisplayNameOf () over and over while it was trying to
invoke a default command. In many cases GetDisplayNameOf was given the same
set of flags and pidl, GetDisplayNameOf would return a different stuff --
sometimes a folder, sometimes a whole path, and sometimes just a filename. I
made a considerable effort to understand this, but eventually just went down
a simpler road.
--
Gak -
Finecats
"Dave Anderson [MS]" wrote:
> Do you have a call stack from when InvokeCommand is calling your
> GetDisplayNameOf?
>
>
date: Thu, 13 Mar 2008 10:35:00 -0700
author: usfinecats am
|
|