Application User Model ID (AppID) Window Property Sample
Demonstrates how to control the taskbar grouping behavior of an application's windows through the System.AppUserModel.ID property.
This topic contains the following sections.
- Description
- Requirements
- Downloading the Sample
- Building the Sample
- Running the Sample
- Related topics
Description
This sample shows how to set the System.AppUserModel.ID property through the use of the window's IPropertyStore implementation, which is obtained through SHGetPropertyStoreForWindow.
Requirements
Product | Minimum Product Version |
---|---|
Windows | Windows 7 |
Windows Software Development Kit (SDK) | 7.0 |
Downloading the Sample
Location | Path URL |
---|---|
GitHub | AppUserModelIDWindowProperty sample |
Building the Sample
To build the sample from the command prompt:
- Open the command prompt window and navigate to the AppUserModelIDWindowProperty project directory.
- Enter
msbuild AppUserModelIDWindowProperty.sln
.
To build the sample using Microsoft Visual Studio (preferred):
- Open Windows Explorer and navigate to the AppUserModelIDWindowProperty project directory.
- Double-click the icon for the AppUserModelIDWindowProperty.sln file to open the project in Visual Studio.
- From the Build menu, select Build Solution.
Running the Sample
- Navigate to the directory that contains the new executable, using the command prompt or Windows Explorer.
- At the command line, enter
AppUserModelIDWindowProperty.exe
. Alternatively, from Windows Explorer double-click the icon for AppUserModelIDWindowProperty.exe. - To demonstrate the effect Application User Model IDs (AppUserModelIDs) have on taskbar grouping, launch at least three instances of the application at the same time.
- Use the menu to set a different AppUserModelID on each of the three windows. Notice that each separate AppUserModelID results in a separate taskbar button and that windows can change their identity at runtime.
- Set at least two windows to the second AppUserModelID. Notice that they both move into the same taskbar group.
- Open the Taskbar and Start Menu Properties window by right-clicking the taskbar and selecting Properties in the context menu. Change the Taskbar buttons: drop-down between the Combine when taskbar is full and Never combine values. Notice that each window can get a separate button, but that the buttons are grouped by AppUserModelID.
Related topics