Recently, I wrote about how you can organize the display of tabs for the child windows of our application. In this case, we needed to display the child windows of our application. For these purposes, we used the CustomWindowManager class.
The same effect can be achieved if we run several instances of the same our application. In this case, Windows 7 will determine that it is the same application and will group the windows into one icon.
')
Let's try to figure out how it works. At the core of all is such a thing as Application ID. For each window, we can set your ID. This feature can also be used when it is necessary to avoid such behavior. In this case, you need to set different AppId for each such window. This can be done using the .NET Interop Sample Library. To do this, call the SetAppId method.
private void SetAppIdButton_Click(object sender, EventArgs e)
{
WindowsFormsExtensions.SetAppId(this, “SomeAppId”);
}
Thus, we can set different AppId for each window and they will not be grouped.
However, in a similar way, it is also possible to group several windows from different applications. To do this, you must specify the same AppId for each of the windows. And in this case, the Windows 7 taskbar will group these applications into one icon. For example, in this case I set the same AppId for different windows from different applications and these windows were grouped in the taskbar of Windows 7.
Demo application:
Taskbar-AppId.zip