0

NSE meaning namesapce extension (https://msdn.microsoft.com/en-us/library/windows/desktop/cc144095%28v=vs.85%29.aspx)

I have a namespace extension developed using the DefView.

I am handling FMTID_PropList+PID_PropList_ContentViewModeForBrowse and returning the correct proplist-string.

When I browse my nse in "Content View" in Windows Explorer, renaming does not work.

Additionally, I notice that Windows Explorer prefixes the value of my first column (which is the item name) with "Name: - it does not do this for items in the filesystem.

How can I solve both the above issues?

I copied the question from:

https://social.msdn.microsoft.com/Forums/en-US/a88ca56d-542e-46a8-81b4-7c37431ea26a/renaming-in-my-nse-does-not-work-in-content-view?forum=windowsuidevelopment

I'm having the exact same issue and could not find any help on the web.

Denis Anisimov
  • 3,297
  • 1
  • 10
  • 18
Mugen
  • 8,301
  • 10
  • 62
  • 140
  • What do you mean "does not work"? Do your items advertise the `SFGAO_CANRENAME` property? Do you implement `IShellFolder::SetNameOf`? Does it get called? – Jonathan Potter Feb 25 '15 at 11:06
  • I mean that it works in any other view. Only Content view is not doing anything. Rename is enabled. SetNameOf() is not getting called, and as mentioned, it does get called in other views (i.e tiles, icons..) – Mugen Feb 25 '15 at 11:26
  • What is the PKEY of first column? How do you create IContextMenu of object? With CDefFolderMenu_Create2 or SHCreateDefaultContextMenu or your own implementation? Do you return IPropertyStore/IPropertyStoreFactory implementation when shell calls BindToObject? – Denis Anisimov Feb 25 '15 at 18:12
  • I'm not sure about PKEY. I'm using columns by index, relaying on GetDetailsOf(). I'm implementing my own derieved ContextMenu and am injecting it to the items by IOC. In BindToObject() I'm using Marshal.GetComInterfaceForObject(). – Mugen Feb 26 '15 at 06:00
  • What your NSE returns when shell call IShellFolder2::MapColumnToSCID(0)? (Please use @MyPersonName in your comments, without it I don`t have notifications about your comments) – Denis Anisimov Feb 26 '15 at 07:35
  • @DenisAnisimov sorry but I'm still struggling to understand what you are trying to check. MapColumnToSCID has two parameters. If I pass the uint as 0, simply the first column is returned (meaning GUID and PID). If I pass the IntPtr as 0 (NULL) then my function will return Win32.E_FAIL – Mugen Feb 26 '15 at 08:20
  • I want to know that GUID and PID the function returns when shell requests first column. – Denis Anisimov Feb 26 '15 at 08:50
  • @DenisAnisimov For the first column, GUID is "b725f130-47ef-101a-a5f1-02608c9eebac" and PID is 10. – Mugen Feb 26 '15 at 09:06
  • And what NSE returns when shell requests PKEY_PropList_ContentViewModeForBrowse (FMTID_PropList+PID_PropList_ContentViewModeForBrowse in your terminology)? – Denis Anisimov Feb 26 '15 at 09:24
  • @DenisAnisimov I am checking this case, and for it I'm returning only my first column. Which is as I described above. – Mugen Feb 26 '15 at 09:27
  • I mean what is your proplist-string. – Denis Anisimov Feb 26 '15 at 09:36
  • @DenisAnisimov the string is "prop:{b725f130-47ef-101a-a5f1-02608c9eebac} 10" – Mugen Feb 26 '15 at 09:51
  • 1
    Replace your proplist-string with "prop:~System.ItemNameDisplay" – Denis Anisimov Feb 26 '15 at 10:03
  • @DenisAnisimov This worked! thanks! please post this as an answer so I can accept it. I would love if you could also explain a bit why this worked and the other didn't. – Mugen Feb 26 '15 at 11:27

1 Answers1

2

You are using obsolete format of proplist string. It was actual in Windows XP era. Starting from Windows Vista it is necessary to use new format. Instead of GUID and PID you must use canonical name of property key. That why Windows does not allow user to rename your object in content view mode.

{b725f130-47ef-101a-a5f1-02608c9eebac} 10 is equal to PKEY_ItemNameDisplay with canonical name System.ItemNameDisplay.

"~" char before canonical name has a special meaning. If it does not present shell shows label before value. In case of System.ItemNameDisplay label is "Name".

Denis Anisimov
  • 3,297
  • 1
  • 10
  • 18