2016-08-17 46 views
0

Windows有文件注册一个标志名为“IsShortcut”。设置此标志时,文件会自动给出快捷图标叠加,并以其他方式将其视为快捷方式(例如,当您右键单击并选择“创建快捷方式”时,它只是复制文件而不是生成.lnk文件)。 Microsoft对ClickOnce应用程序引用使用此功能(扩展.appref-ms)。Windows资源管理器和自定义快捷方式的文件类型

我们将此功能用于我们自己的软件的自定义快捷方式文件类型,我们发现自Windows 10(或可能是Windows 8)以来,我们的自定义快捷方式不会出现在“开始”菜单中。当然开始菜单列出了.lnk文件,它的确实包含包括.appref-ms文件,但是我们自己的文件格式,其注册文件与.appref-ms文件没有实质上的区别,它被排除在开始菜单之外。快捷方式文件实际存在于开始菜单文件夹结构(%APPDATA%\Microsoft\Windows\Start Menu\Programs)中,但Windows资源管理器会忽略这些快捷方式文件。其他快捷方式类型(.lnk.appref-ms)会显示在同一个目录中。

什么我要找的是Windows资源管理器如何确定它将包括在开始菜单的文件格式,使开发自定义格式时,可以以相同的方式表示了一些指示。我们的自定义格式在Windows XP,Windows Vista和Windows 7中运行良好,但较新的开始菜单设计,由于某种原因,排除了我们的文件格式,即使它被标记以同样的方式为.appref-ms文件IsShortcut

这可能吗? :-)

+0

您是否实现了与文件扩展名关联的IShellLink外壳扩展? –

+0

我们没有。 “IShellLink”的大部分成员不能用我们的快捷方式实现。例如,我们的快捷方式存储一个或多个应用程序名称值,然后将其传递给启动器。程序文件的确切路径是未知的,即使它是,也可能有多个。这使得无法正确实现'GetPath' /'SetPath'。 这不可能是浏览器是如何决定显示哪些快捷键,虽然,否则就必须加载和以显示列表中给定文件夹测试每一个快捷方式文件。这将表现不佳。 –

+0

虽然...我想它会加载并测试它实际显示的每个快捷方式,否则图标处理程序将无法工作。我想这不能排除的是,浏览器可能会使用'IShellLink'的信号量是否显示给定的快捷方式... –

回答

1

(这是不是问题的答案,但可以帮助你在你的调查。)

我创建并registred我自己的壳链路扩展。资源管理器重新启动后,它使用我的扩展并通过IPropertyStore接口询问不同的属性。完整的日志:

TMyLinkExtension.07BA12F0 is created 
    TMyLinkExtension.07BA12F0.QueryInterface IID_IShellLinkW out Result=S_OK 
    TMyLinkExtension.07BA12F0.QueryInterface IID_IInitializeWithFile out Result=S_OK 
    TMyLinkExtension.07BA12F0.IInitializeWithFile.Initialize started 
    TMyLinkExtension.07BA12F0.IInitializeWithFile.Initialize in AFileName=C:\Users\Dec\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Total Commander\1.mylnk 
    TMyLinkExtension.07BA12F0.IInitializeWithFile.Initialize in AOpenMode=STGM_READ 
    TMyLinkExtension.07BA12F0.IInitializeWithFile.Initialize out Result=S_OK 
    TMyLinkExtension.07BA12F0.IInitializeWithFile.Initialize finished 
    TMyLinkExtension.07BA12F0.QueryInterface IID_IShellLinkW out Result=S_OK 
    TMyLinkExtension.07BA12F0.QueryInterface IID_IShellLinkDataList out Result=S_OK 
    TMyLinkExtension.07BA12F0.IShellLinkDataList.GetFlags started 
    TMyLinkExtension.07BA12F0.IShellLinkDataList.GetFlags out Result=E_NOTIMPL 
    TMyLinkExtension.07BA12F0.IShellLinkDataList.GetFlags finished 
    TMyLinkExtension.07BA12F0.IShellLinkW.GetPath started 
    TMyLinkExtension.07BA12F0.IShellLinkW.GetPath in AFileName=0C1FF058 
    TMyLinkExtension.07BA12F0.IShellLinkW.GetPath in AFileNameLength=260 
    TMyLinkExtension.07BA12F0.IShellLinkW.GetPath in @AFindData=0C1FEE08 
    TMyLinkExtension.07BA12F0.IShellLinkW.GetPath in AFlags=SLGP_RAWPATH 
    TMyLinkExtension.07BA12F0.IShellLinkW.GetPath out Result=E_NOTIMPL 
    TMyLinkExtension.07BA12F0.IShellLinkW.GetPath finished 
    TMyLinkExtension.07BA12F0.QueryInterface IID_IPropertyStore out Result=S_OK 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey=PKEY_AppUserModel_ID (Caption: AppUserModelId, CanonicalName: System.AppUserModel.ID, Type: VT_LPWSTR) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=E_INVALIDARG 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey=PKEY_AppUserModel_PreventPinning (Caption: Prevent pinning, CanonicalName: System.AppUserModel.PreventPinning, Type: VT_BOOL) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out AData.vt=VT_BOOL 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out AData=0 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=S_OK 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey={9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 23 (Caption: System.AppUserModel.ExcludedFromLauncher, CanonicalName: System.AppUserModel.ExcludedFromLauncher, Type: VT_BOOL) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out AData.vt=VT_BOOL 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out AData=0 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=S_OK 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey={9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 14 (Caption: Host environment, CanonicalName: System.AppUserModel.HostEnvironment, Type: VT_UI4) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=E_INVALIDARG 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey=PKEY_AppUserModel_StartPinOption (Caption: Start pin option, CanonicalName: System.AppUserModel.StartPinOption, Type: VT_UI4) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=E_INVALIDARG 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey={9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}, 18 (Caption: Installed by, CanonicalName: System.AppUserModel.InstalledBy, Type: VT_UI4) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=E_INVALIDARG 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey=PKEY_AppUserModel_IsDualMode (Caption: Is dual mode, CanonicalName: System.AppUserModel.IsDualMode, Type: VT_BOOL) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=E_INVALIDARG 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue started 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue in AKey=PKEY_Link_Arguments (Caption: Arguments, CanonicalName: System.Link.Arguments, Type: VT_LPWSTR) 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue out Result=E_INVALIDARG 
    TMyLinkExtension.07BA12F0.IPropertyStore.GetValue finished 
TMyLinkExtension.07BA12F0 is destroyed 

我试着用不同的值来发挥,但仍然无法找到,显示在开始菜单中我1.mylnk文件的方式,但也许这个记录会帮助你。

+0

所以这个日志是通过打开开始菜单生成的?它收集有关您的快捷方式的详细信息,但最终决定不显示它? –

+0

是的。是。也许我必须在我的示例中处理更多PropertyKeys(所有这些?)以强制Explorer显示我的链接。 –

+0

因此,我打电话给Microsoft客户支持,经过几个月的深思熟虑后,他们终于打电话告诉我它超出了范围。他们建议在客户支持论坛上发帖,所以我这样做了:https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/7c88d220-2363-4cfb-8ae1-87be143d85b7/custom-shortcut-filetypes?论坛= windowsgeneraldevelopmentissues 最新的信息表明,这实际上是Windows资源管理器中的一个错误。寻找两个最近的评论,文字“一个非正式的评论”和“另一个,非常简洁的方式来重现这个问题。” –

相关问题