Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update class.MD #360

Open
wants to merge 9 commits into
base: users/GitHubPolicyService/4fc3f05e-a80a-4e2e-b097-a0f6ad55c269
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions Samples/AppTabsIntegration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
page_type: sample
languages:
- cpp
products:
- windows-api-win32
name: Tab Integration sample
urlFragment: apptabsintegration-sample
description: Demonstrates how tabbed apps can expose their tabs to the system.
extendedZipContent:
- path: LICENSE
target: LICENSE
---

# Tab Integration sample

This sample shows how a tabbed app can expose its tabs to the system.

* Detecting whether WindowTab support exists on the system.
* Obtaining the WindowTabManager for a window.
* Associating each app tab with a WindowTab object.
* Updating the list of WindowTabs when the app tabs change.
* Updating the the WindowTab as the app tab's state changes.
* Setting the WindowTab as active when the user changes tabs.
* Providing thumbnails for tabs.
* Responding to system-initiated tab switches.
* Responding to system-initiated tab tear-out.

**Note** The Windows-classic-samples repo contains a variety of code samples that exercise the various programming models, platforms, features, and components available in Windows and/or Windows Server. This repo provides a Visual Studio solution (SLN) file for each sample, along with the source files, assets, resources, and metadata needed to compile and run the sample. For more info about the programming models, platforms, languages, and APIs demonstrated in these samples, check out the documentation on the [Windows Dev Center](https://dev.windows.com). This sample is provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs for Windows and/or Windows Server.

This sample was created for Windows 11 using features added in the May 2023 release, using Visual Studio and the Windows SDK 10.0.22621.1778, but it should also work with later versions of Windows and the Windows SDK.

To get a copy of Windows, go to [Downloads and tools](http://go.microsoft.com/fwlink/p/?linkid=301696).

To get a copy of Visual Studio, go to [Visual Studio Downloads](http://go.microsoft.com/fwlink/p/?linkid=301697).

## Related topics

[**WindowTabManager**](https://learn.microsoft.com/en-us/uwp/api/windows.ui.shell.windowtabmanager)

## Operating system requirements

Windows 11 May 2023 release

## Build the sample

* Install the Windows SDK version 10.0.22621.1778 or higher.
* Open the solution (*.sln*) file titled *AppTabsIntegration.sln* from Visual Studio.
* **Important**: Add a reference to the Desktop Extension SDK version 10.0.22621.1778 or higher. (If you forget, the build will remind you.)
* Press Ctrl+Shift+B or select **Build** \> **Build Solution**.

## Run the sample

Press F5 or select Debug \> Start Debugging. To run the sample without debugging, press Ctrl+F5 or select Debug \> Start Without Debugging.

Things to try with the sample:

* Use the + button to create multiple tabs.
* Alt+Tab integration: Requires "Show tabs from apps when snapping or pressing Alt+Tab" in Settings to show recent tabs.
* Press Alt+Tab and observe that additional tabs show up in the Alt+Tab list in addition to the active tab. The app itself is represented by the active tab. The most recently used non-active tabs show up as separate windows in the Alt+Tab UI.
* Select one of the non-active tabs. Observe that the app switches tabs to the tab you selected.
* Snap Assist integration: Requires Alt+Tab integration, as well as "Snap windows" and "When I snap a window, suggest what I can snap next to it" to be enabled.
* Snap the app window to trigger Snap Assist. Observe that the most recently used non-active tabs show up as snap options.
* Select one of the non-active tabs of the window that you snapped. Observe that the tab is "torn out" and placed next to the snapped window.
* Select a tab, change its title, and change its color. Repeat the above steps to observe that the changes are reflected in the Alt+Tab and Snap Assist UI.
6 changes: 6 additions & 0 deletions Samples/AppTabsIntegration/cpp/App.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

namespace AppTabsIntegration
{
}
18 changes: 18 additions & 0 deletions Samples/AppTabsIntegration/cpp/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->

<Application
x:Class="AppTabsIntegration.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppTabsIntegration">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
48 changes: 48 additions & 0 deletions Samples/AppTabsIntegration/cpp/App.xaml.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#include "pch.h"

#include "App.xaml.h"
#include "MainWindow.xaml.h"

using namespace winrt;
using namespace Windows::Foundation;
using namespace Microsoft::UI::Xaml;
using namespace Microsoft::UI::Xaml::Controls;
using namespace Microsoft::UI::Xaml::Navigation;
using namespace AppTabsIntegration;
using namespace AppTabsIntegration::implementation;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
App::App()
{
InitializeComponent();

#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e)
{
if (IsDebuggerPresent())
{
auto errorMessage = e.Message();
__debugbreak();
}
});
#endif
}

/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
void App::OnLaunched(LaunchActivatedEventArgs const&)
{
window = make<MainWindow>();
window.Activate();
}
19 changes: 19 additions & 0 deletions Samples/AppTabsIntegration/cpp/App.xaml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#pragma once

#include "App.xaml.g.h"

namespace winrt::AppTabsIntegration::implementation
{
struct App : AppT<App>
{
App();

void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const&);

private:
winrt::Microsoft::UI::Xaml::Window window{ nullptr };
};
}
43 changes: 43 additions & 0 deletions Samples/AppTabsIntegration/cpp/AppTabsIntegration.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33502.453
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppTabsIntegration", "AppTabsIntegration.vcxproj", "{4FCF5980-C8B1-4E00-93D9-F79C7B718387}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|ARM64.Build.0 = Debug|ARM64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|ARM64.Deploy.0 = Debug|ARM64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|x64.ActiveCfg = Debug|x64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|x64.Build.0 = Debug|x64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|x64.Deploy.0 = Debug|x64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|x86.ActiveCfg = Debug|Win32
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|x86.Build.0 = Debug|Win32
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Debug|x86.Deploy.0 = Debug|Win32
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|ARM64.ActiveCfg = Release|ARM64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|ARM64.Build.0 = Release|ARM64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|ARM64.Deploy.0 = Release|ARM64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|x64.ActiveCfg = Release|x64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|x64.Build.0 = Release|x64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|x64.Deploy.0 = Release|x64
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|x86.ActiveCfg = Release|Win32
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|x86.Build.0 = Release|Win32
{4FCF5980-C8B1-4E00-93D9-F79C7B718387}.Release|x86.Deploy.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {21BA6E0B-FCDD-4DA9-AFDC-AD787992E696}
EndGlobalSection
EndGlobal
Loading