Windows 视窗浏览器&;自定义快捷方式文件类型

Windows 视窗浏览器&;自定义快捷方式文件类型,windows,explorer,file-type,startmenu,Windows,Explorer,File Type,Startmenu,Windows在文件注册中有一个名为“IsShortcut”的标志。设置此标志后,文件将自动设置快捷方式图标覆盖,并以其他方式被视为快捷方式(例如,当您右键单击并选择“创建快捷方式”时,它只是复制文件,而不是生成.lnk文件)。Microsoft将此功能用于ClickOnce应用程序引用(扩展名.appref ms) 我们使用此功能为自己的软件自定义快捷方式文件类型,我们发现,自Windows 10(或可能是Windows 8)以来,自定义快捷方式不会出现在“开始”菜单中。当然,“开始”菜单列出

Windows在文件注册中有一个名为“IsShortcut”的标志。设置此标志后,文件将自动设置快捷方式图标覆盖,并以其他方式被视为快捷方式(例如,当您右键单击并选择“创建快捷方式”时,它只是复制文件,而不是生成.lnk文件)。Microsoft将此功能用于ClickOnce应用程序引用(扩展名
.appref ms

我们使用此功能为自己的软件自定义快捷方式文件类型,我们发现,自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

这可能吗?:-)

(这不是答案,但可能有助于您的调查。)

我创建并注册了自己的shell链接扩展。资源管理器重新启动后,它使用my扩展并通过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文件的方法,但此日志可能会对您有所帮助。

(这不是答案,但可能会对您的调查有所帮助。)

我创建并注册了自己的shell链接扩展。资源管理器重新启动后,它使用my扩展并通过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.myLink文件的方法,但此日志可能会对您有所帮助。

要在Windows 10 startmenu中显示链接,必须实现IPropertyStore.GetValue,并为
PKEY\u AppUserModel\u ID
属性返回一些唯一的字符串

要在Windows 10 startmenu中显示图标,必须实现
iextractConw.GetIconLocation
,并且具有CLSID类(即HKEY_CLASSES_ROOT\CLSID{42465C3A-83D3-4310-B27D-F271DE372764})的注册表项的所有者必须是“NT Service\TrustedInstaller”

以下是示例实现(增强的Jonathan Gilbert代码):

要在Windows 10 startmenu中显示链接,必须实现
IPropertyStore.GetValue
,并为
PKEY\u AppUserModel\u ID
属性返回一些唯一的字符串

要在Windows 10 startmenu中显示图标,必须实现
iextractConw.GetIconLocation
,并且具有CLSID类(即HKEY_CLASSES_ROOT\CLSID{42465C3A-83D3-4310-B27D-F271DE372764})的注册表项的所有者必须是“NT Service\TrustedInstaller”

以下是示例实现(增强的Jonathan Gilbert代码):

您是否实现了与文件扩展名关联的IShellLink外壳扩展名?我们没有。
IShellLink
的大多数成员无法使用我们的快捷方式实现。例如,我们的快捷方式存储一个或多个应用程序名称值,然后将这些值传递给启动器。程序文件的确切路径未知,即使知道,也可能不止一个。这使得无法正确实现
GetPath
/
SetPath
。不过,这不是Explorer确定要显示哪些快捷方式的方式,否则它必须加载并测试每个快捷方式文件才能显示给定文件夹的列表。那会表现很差。不过。。。我想它确实加载并测试了它实际显示的每个快捷方式,否则图标处理程序将无法工作。我想不能排除Explorer可能会使用
IShellLink
作为是否显示给定快捷方式的信号灯…如果无法正确实现GetPath/SetPath,可以尝试返回E_NOTIMPL。从8.1开始,链接还实现IPropertyStore。shell请求一些属性,如颜色、文本等。也许(我不确定是否只是假设)shell请求类似PKEY_canshow instartmenu的东西。我想这是值得调查的。:-)您是否实现了与文件扩展名关联的IShellLink外壳扩展名?我们没有。
IShellLink
的大多数成员无法使用我们的快捷方式实现。例如,我们的快捷方式存储一个或多个应用程序名称值,然后将这些值传递给启动器。程序文件的确切路径未知,即使知道,也可能不止一个。这使得无法正确实现
GetPath
/
SetPath
。不过,这不是Explorer确定要显示哪些快捷方式的方式,否则它必须加载并测试每个快捷方式文件才能显示给定文件夹的列表。那会表现很差。不过。。。我想它确实加载并测试了它实际显示的每个快捷方式,否则图标处理程序将无法工作。我想不能排除Explorer可能会使用
IShellLink
作为是否显示给定快捷方式的信号灯…如果无法正确实现GetPath/SetPath,可以尝试返回E_NOTIMPL。从8.1开始,链接还实现IPropertyStore。壳牌公司要求一些财产