*.lnk - Files

Feb 24, 2014 at 10:33 PM

it took some time, but I got a solution for working with lnk files and sharpshell. As mentioned in http://stackoverflow.com/questions/21848694/windows-shell-extension-doesnt-give-exact-file-paths lnk files will be translated into their target path and don't return their actual location (location of the lnk // for my purpose this is bad...).

So a possibility to solve this is to add a direct association to the link with
[COMServerAssociation(AssociationType.ClassOfExtension, ".lnk")]
(by the way AssociationType link would give a good pointer that there are special needs for links)

... so the problem is now to get to know what a link content is now (... maybe link content is needed as well as the link-file itself as information to proceed, but it must be marked as one, else the sharpshell-developer has no choice than to take these entries too)

Solution is to add in SharpContextMenu.cs in IContextMenu.QueryContextMenu this piece of code to filter it:
if (uFlags.HasFlag(CMF.CMF_VERBSONLY) && this.SettingToFilterIJustInventedHere)
    return WinError.MAKE_HRESULT(WinError.SEVERITY_SUCCESS, 0, 0);
Please send me some feedback, I would love to see this in the new release.

kind regards,
Mar 1, 2014 at 7:35 PM
Great work Daniel - I've raised a task to deal with this that can be followed here:


Thanks for your work on this!