本文介绍了如何在Windows属性系统中创建IconList属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

当前,我的属性处理程序提供的属性可以显示在String类型的Windows资源管理器列中.我的目标是通过(显示)类型 Icon 的属性扩展处​​理程序,该属性可以作为列添加到Windows资源管理器的详细信息视图中.在此列中,应该为每个文件项显示一个图标,例如. G.该图标可以代表文件在几种可能状态中的特定状态.

Currently, my property handler provides properties that can be displayed in Windows Explorer columns of type String. My goal is to extend the handler by a property of (display) type Icon, that can be added as a column to the details view of Windows Explorer. In this column, an icon should be displayed for each file item, e. g. the icon could represent a specific state of the file out of several possible states.

但是,我没有设法在Windows属性系统的基础上正确地组装创建具有这些特征的属性的必要部分.

However, I did not manage to assemble the necessary parts of creating a property with these characteristics on the base of the Windows Property System correctly.

我的方法的第一步是在 .propdesc 文件中为属性指定XML,然后执行通常的PSRegisterPropertySchema注册过程.这将始终成功运行,并且该属性在Windows属性系统中列出.

The first step of my approach is to specify the XML for the property in a .propdesc file and then go through the usual PSRegisterPropertySchema registration process. This runs always successfully and the property is listed in the Windows Property System.

<propertyDescription name="myprop.icon" formatID="{c5f47221-1053-4a75-aadc-0bfbac1c3e9c}" propID="444">
    <typeInfo type="???" isInnate="true" isViewable="true"/>
    <labelInfo label="MyProp-Icon"/>
    <displayInfo defaultColumnWidth="25" alignment="Center">
        <drawControl control="IconList"/>
    </displayInfo>
</propertyDescription>

<drawControl>的存在( drawControl )在<displayInfo>标签中具有"IconList"类型的control属性,这使我感到我的想法可行.

The existence of <drawControl> (drawControl) with a control attribute of type "IconList" within the <displayInfo> tag makes me feel that my idea could be feasible.

但是如何在<typeInfo>标记中设置相应的type( typeInfo )?根据control="IconList"的概念,它可以是整数作为索引变成有点像一个图像列表.还是代表图像本身的"Buffer""Blob""Stream"?

But how to set the corresponding type in the <typeInfo> tag (typeInfo)? Depending on the concept of control="IconList" this could be an integer as an indexinto somewhat like an imagelist. Or is it a "Buffer", "Blob" or "Stream" representing the image itself?

最后,在属性处理程序外壳扩展的GetValue()方法中,必须根据 .propdesc 文件的属性描述来初始化PROPVARIANT:

Last, in the GetValue() method of the Property Handler shell extension the PROPVARIANT has to be initialized according to the property description of the .propdesc file:

HRESULT PropertyHandler::GetValue (REFPROPERTYKEY key, PROPVARIANT *pPropVar)
{
    HRESULT hr = ERROR_NOT_FOUND;

    if (key.pid == 444)
    {
        // How to initialize pPropVar in case of control="IconList"?
    }
    else
    {
        // String example
        hr = InitPropVariantFromString (L"Some Text", pPropVar);
    }

    return hr;
}

再次,如何对"IconList"属性执行此操作?

Again, how to do this for "IconList" properties?

每次尝试在XML规范和PROPVARIANT初始化之间找到正确的匹配项,Windows资源管理器中的相应列都为空白.

Each attempt to find a correct match between the XML specification and the PROPVARIANT initialization leaves the corresponding column in Windows Explorer blank.

有人已经实现了类型为IconList<drawControl>的财产吗?

Does anybody already implemented a property with a <drawControl> of type IconList?

推荐答案

propsys.dll中有WINDOWSPROPERTYDESCRIPTIONS资源.此资源描述了所有系统道具.一些属性的drawcontrol等于IconList.示例:

There is WINDOWSPROPERTYDESCRIPTIONS resource inside propsys.dll. This resource describes all system props. Some of properties have drawcontrol equal to IconList. Example:

<propertyDescription name="System.StorageProviderUIStatus" formatID="{E77E90DF-6271-4F5B-834F-2DD1F245DDA4}" propID="2">
  <searchInfo reIndexPatterns="" processReIndexPatternsImmediately="true" inInvertedIndex="false" isColumn="false">
  </searchInfo>
  <typeInfo type="Blob" isInnate="true" isViewable="true">
  </typeInfo>
  <labelInfo label="@propsys.dll,-42289">
  </labelInfo>
  <displayInfo defaultColumnWidth="10">
    <drawControl control="IconList">
    </drawControl>
  </displayInfo>
</propertyDescription>

所有此类道具的类型均等于斑点".所以Blob是答案.

ALL of such props have type equal to "Blob". So Blob is answer.

更新

我的小调查.

(对我而言)唯一显示图标的处理程序是OneDrive.截图:

The only known (by me) handler that shows icons is OneDrive. Screenshot:

我获得了OneDrive文件之一的System.StorageProviderUIStatus属性的值.价值转储:

I got value of System.StorageProviderUIStatus property of one of OneDrive files. Value dump:

您看到的不是图像或图标.这是[MS-PROPSTORE]中描述的属性存储二进制文件.解码形式:

As you see this is not image or icon. This is Property Store Binary File described in [MS-PROPSTORE]. Decoded form:

System.PropList.StatusIcons = prop:System.StorageProviderState;System.StorageProviderCustomStates
System.PropList.StatusIconsDisplayFlag = 3
StorageProviderState = 2
StorageProviderCustomStates = (binary data)

嵌入式属性存储二进制文件中的二进制数据.其解码形式:

Binary data in embedded Property Store Binary File. Its decoded form:

StorageProviderFullyQualifiedId = OneDrive!S-1-5-21-782054983-1121033576-3753986437-1001!Personal|79D9464945C2A3B2!331

对于简单的图标描述,一切看起来都很困难.也许我错了,并且Blob类型不是唯一的答案.

Everything looks quite hard for simple icon description. And maybe I`am wrong and Blob type is not the only answer.

解决方案

propdesc文件的内容:

Content of propdesc file:

<propertyDescription name="DummyUIState" formatID="{8A560909-320E-4E6A-A6C4-A95C50B77084}" propID="5001">
  <searchInfo columnIndexType="NotIndexed"/>
  <labelInfo label="DummyUIState"/>
  <typeInfo type="Blob" isInnate="true" isViewable="true"/>
  <displayInfo defaultColumnWidth="10">
    <drawControl control="IconList"/>
  </displayInfo>
</propertyDescription>

<propertyDescription name="DummyState" formatID="{8A560909-320E-4E6A-A6C4-A95C50B77084}" propID="5000">
  <searchInfo columnIndexType="NotIndexed"/>
  <labelInfo label="DummyState"/>
  <typeInfo type="UInt32" isInnate="true" isViewable="true"/>
  <displayInfo displayType="Enumerated">
    <enumeratedList>
      <enum name="None" value="0" text="@propsys.dll,-42290"/>
      <enum name="Sparse" value="1" text="@propsys.dll,-42291">
        <image res="%systemroot%\system32\imageres.dll,-1404"/>
      </enum>
      <enum name="InSync" value="2" text="@propsys.dll,-42292">
        <image res="%systemroot%\system32\imageres.dll,-1400"/>
      </enum>
      <enum name="Pinned" value="3" text="@propsys.dll,-42293">
        <image res="%systemroot%\system32\imageres.dll,-1405"/>
      </enum>
      <enum name="PendingUpload" value="4" text="@propsys.dll,-42294">
        <image res="%systemroot%\system32\imageres.dll,-1401"/>
      </enum>
      <enum name="PendingDownload" value="5" text="@propsys.dll,-42303">
        <image res="%systemroot%\system32\imageres.dll,-1401"/>
      </enum>
      <enum name="Transferring" value="6" text="@propsys.dll,-42296">
        <image res="%systemroot%\system32\imageres.dll,-1401"/>
      </enum>
      <enum name="Error" value="7" text="@propsys.dll,-42315">
        <image res="%systemroot%\system32\imageres.dll,-1402"/>
      </enum>
      <enum name="Warning" value="8" text="@propsys.dll,-42316">
        <image res="%systemroot%\system32\imageres.dll,-1403"/>
      </enum>
      <enum name="Excluded" value="9" text="@propsys.dll,-42319"/>
      <enum name="Pending" value="10" text="@propsys.dll,-42324">
        <image res="%systemroot%\system32\imageres.dll,-1401"/>
      </enum>
    </enumeratedList>
  </displayInfo>
</propertyDescription>

当外壳程序请求DummyUIState时,必须使用属性存储二进制文件创建blob.属性存储库二进制文件必须包含以下数据:

When shell request DummyUIState you must create blob with Property Store Binary File. Property Store Binary File must contain the following data:

  1. 键System.PropList.StatusIcons,类型为VT_LPWSTR的值等于prop:DummyState
  2. 键System.PropList.StatusIconsDisplayFlag,类型为VT_UI4的值等于2(2-仅图标,1-图标+文本)
  3. 键DummyState,值类型VT_UI4.此值定义图标.

仅此而已.在Windows 10上进行了测试.屏幕截图:

That's all. Tested on Windows 10. Screenshot:

这篇关于如何在Windows属性系统中创建IconList属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:57