Windows资源管理器和自定义快捷文件类型。

时间:2022-10-17 22:59:37

Windows has a flag in file registrations called "IsShortcut". When this flag is set, the file is automatically given the shortcut icon overlay and is treated as a shortcut in other ways (for instance, when you right click and select "Create Shortcut", it simply copies the file instead of generating a .lnk file). Microsoft uses this feature for ClickOnce Application References (extension .appref-ms).

Windows在文件注册中有一个名为“is快捷方式”的标志。当设置此标志时,文件将自动获得快捷方式图标叠加,并以其他方式作为快捷方式处理(例如,当您右键单击并选择“创建快捷方式”时,它只是复制文件,而不是生成.lnk文件)。Microsoft使用这个特性用于ClickOnce应用程序引用。

We use this feature for a custom shortcut file type for our own software, and what we have found is that since Windows 10 (or possibly Windows 8), our custom shortcuts do not appear in the Start Menu. The Start Menu of course lists .lnk files, and it does include .appref-ms files as well, but our own file format, whose registration does not appear substantively different from .appref-ms files, is excluded from the Start Menu. The shortcut files are physically present within the Start Menu folder structure (%APPDATA%\Microsoft\Windows\Start Menu\Programs) but are ignored by Windows Explorer. Other shortcut types (.lnk and .appref-ms) in the same directory do show up.

我们将此特性用于我们自己的软件的自定义快捷文件类型,我们发现,由于Windows 10(或者可能是Windows 8),我们的自定义快捷键不会出现在开始菜单中。开始菜单当然列出了。lnk文件,它也包括。illuf -ms文件,但是我们自己的文件格式,它的注册看起来与. illuf -ms文件没有本质上的区别,被排除在开始菜单之外。快捷键文件在“开始”菜单文件夹结构(%APPDATA%\Microsoft\Windows\ Windows\ Windows\Start菜单\程序)中物理地显示,但是被Windows资源管理器忽略。其他快捷键类型(。在同一目录中确实出现了lnk和. f-ms。

What I'm looking for is some indication of how Windows Explorer determines which file formats it will include in the Start Menu, so that when developing a custom format, it can be indicated in the same manner. Our custom format worked fine in Windows XP, Windows Vista and Windows 7, but the newer Start Menu design for some reason excludes our file format, even though it is marked IsShortcut in the same manner as .appref-ms files.

我要寻找的是Windows资源管理器如何确定它将包含在开始菜单中的文件格式,以便在开发自定义格式时,可以以同样的方式显示它。我们的自定义格式在Windows XP、windowsvista和Windows 7中运行良好,但由于某些原因,新的开始菜单设计不包括我们的文件格式,尽管它以与. f-ms文件相同的方式标记了is捷径。

Is this possible to do? :-)

这可能吗?:-)

1 个解决方案

#1


1  

(This is not the answer, but may help you in your investigations.)

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

I created and registred my own shell link extension. After Explorer restarts it uses my extension and asks different properties via IPropertyStore interface. Full log:

我创建并注册了我自己的shell链接扩展。在Explorer重启后,它使用我的扩展名,并通过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

I tried to play with different values but still cant find the way to show my 1.mylnk file in the start menu but maybe this log will help you.

我试着用不同的值去玩,但还是找不到显示1的方法。在开始菜单中的mylnk文件,但是这个日志可能会对您有所帮助。

#1


1  

(This is not the answer, but may help you in your investigations.)

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

I created and registred my own shell link extension. After Explorer restarts it uses my extension and asks different properties via IPropertyStore interface. Full log:

我创建并注册了我自己的shell链接扩展。在Explorer重启后,它使用我的扩展名,并通过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

I tried to play with different values but still cant find the way to show my 1.mylnk file in the start menu but maybe this log will help you.

我试着用不同的值去玩,但还是找不到显示1的方法。在开始菜单中的mylnk文件,但是这个日志可能会对您有所帮助。