Share via


ShareWindowCommandSource Class

Definition

Represents an object that your communications app can use to set up communication with the Window Shell to present UI for starting and stopping window sharing.

Obtain an instance of ShareWindowCommandSource, and register to handle the instance's ShareWindowCommandSource.CommandRequested and ShareWindowCommandSource.CommandInvoked events. Those events are raised by the Windows Shell.

Important

The Windows.UI.Shell.ShareWindowCommandSource API is part of a Limited Access Feature (see LimitedAccessFeatures class). For more information or to request an unlock token, please use the LAF Access Token Request Form.

public ref class ShareWindowCommandSource sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 851968)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ShareWindowCommandSource final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 851968)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ShareWindowCommandSource
Public NotInheritable Class ShareWindowCommandSource
Inheritance
Object Platform::Object IInspectable ShareWindowCommandSource
Attributes

Windows requirements

Device family
Windows 11 (introduced in 10.0.22000.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v14.0)

Remarks

This functionality augments the window sharing feature that your application already implements, providing an alternative method for selecting windows. The design allows your app to present start sharing and stop sharing commands; and to implement those in a way that corresponds to your app's ability to share one or more windows.

Your communications app identifies the window that corresponds with the ability to share windows—the single app window, or windows that host communication sessions (calls). The Windows Shell uses this to:

  • Get application identification information, such as its icon and name, which will be presented with the share commands.
  • Select among multiple share command sources. The most recently used sharing app will be selected.

Events are used to request commands and invoke them, this includes the WindowId of the window to be shared.

IShareWindowCommandSourceInterop is a native interoperation interface that allows getting a ShareWindowCommandSource object.

Methods

GetForCurrentView()

A static method that you can use to obtain an instance of a ShareWindowCommandSource.

Important

The ShareWindowCommandSource.GetForCurrentView API is part of a Limited Access Feature (see LimitedAccessFeatures class). For more information or to request an unlock token, please use the LAF Access Token Request Form.

ReportCommandChanged()

Indicates to the Windows Shell that the sharing state of your communications app has changed.

Call this method whenever your communications app's sharing state changes. If you successfully share a new window in a call or meeting, or you remove an already shared window (whether that's via your own UI, or triggered by a Windows Taskbar action), you must notify your ShareWindowCommandSource instance of that change by calling ReportCommandChanged.

The Shell will then flush any information it has received as part of any ShareWindowCommandSource.CommandRequested event, and will update its visible share commands to match the current state of your app.

Start()

Indicates that the calling app is currently a source of window sharing commands. Call this method during a call or meeting to enable your communications app as a source of window sharing commands.

Stop()

Indicates that the calling app is not a source of window sharing commands. Call this method when a call or meeting ends to disable your communications app as a source of window sharing commands.

Events

CommandInvoked

An event that's raised by the Windows Shell to give your communications app an opportunity to actually start or stop sharing a particular window.

CommandRequested

An event that's raised by the Windows Shell to give your communications app an opportunity to support starting or stopping sharing a particular window.

Applies to

See also