支援已封裝應用程式的舊版操作功能表

操作功能表是其中一個最熱門且實用的殼層延伸模組。 如果您已經在 檔案總管 或桌面上,相較於開啟個別的應用程式,它可大幅減少完成檔案作業的步驟數目。

如果您的傳統型應用程式為殼層延伸模組實作舊版 IContextMenu 介面,例如操作功能表處理程式或拖放處理程式,則封裝應用程式之後,殼層延伸模組可能無法運作。 為了讓殼層能夠辨識及註冊延伸模組,您必須修改套件指令清單檔。 (這項功能適用於 Windows 11 組建 22000+,目前可透過 Windows 測試人員 組建)

  • 為您的Shellex dll新增 com 命名空間和 windows.comServer 擴充功能

    xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"

    以下是範例代碼段:

    <com:Extension Category="windows.comServer">
        <com:ComServer>
            <com:SurrogateServer DisplayName="<display-name-for-the-com-server>">
                <com:Class Id="<GUID-for-the-com-server>" Path="<path-to-the-com-server-or-dll>" ThreadingModel="STA" />
            </com:SurrogateServer>
        </com:ComServer>
    </com:Extension>
    
  • 新增 desktop9 命名空間和 windows.fileExplorerClassicContextMenuHandler 或 windows.fileExplorerClassicDragDropContextMenuHandler 延伸模組

    xmlns:desktop9="http://schemas.microsoft.com/appx/manifest/desktop/windows10/9"

    以下是範例代碼段:

    <desktop9:Extension Category="windows.fileExplorerClassicContextMenuHandler">
        <desktop9:FileExplorerClassicContextMenuHandler>
            <desktop9:ExtensionHandler Type="*" Clsid="<GUID-for-the-com-server>" />
            <desktop9:ExtensionHandler Type=".txt" Clsid="<GUID-for-the-com-server>" />
            <desktop9:ExtensionHandler Type="Directory" Clsid="<GUID-for-the-com-server>" />
        </desktop9:FileExplorerClassicContextMenuHandler>
    </desktop9:Extension>
    
    <desktop9:Extension Category="windows.fileExplorerClassicDragDropContextMenuHandler">
        <desktop9:FileExplorerClassicDragDropContextMenuHandler>
            <desktop9:ExtensionHandler Type="Directory" Clsid="<GUID-for-the-com-server>" />
            <desktop9:ExtensionHandler Type="Drive" Clsid="<GUID-for-the-com-server>" />
        </desktop9:FileExplorerClassicDragDropContextMenuHandler>
    </desktop9:Extension>
    
  • 將 MaxVersionTested 變更為大於 10.0.21300.0

    以下是範例代碼段:

    <Dependencies>
        <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.21301.0" />
    </Dependencies>
    

注意

如果您要實作殼層延伸模組,而不是使用舊版 IContextMenu 實作封裝現有的傳統型應用程式,建議您改為實作 IExplorerCommand 介面,並使用 desktop4:FileExplorerContextMenus。 如需詳細資訊,請參閱 這裡