Programming Windows 7: Taskbar. Part 6 - AppId

    Recently, I wrote about how you can organize the display of tabs for 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 this is the same application and will group the windows into a single icon.

    Let's try to figure out how it works. At the heart of everything lies such a concept as Application ID. For each window we can set its own 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. You can do this using the .NET Interop Sample Library. To do this, call the SetAppId method. Thus, we can set different AppId for each window and they will not be grouped.

    private void SetAppIdButton_Click(object sender, EventArgs e)
    WindowsFormsExtensions.SetAppId(this, “SomeAppId”);

    However, in a similar way, it is also possible to group several windows from different applications. To do this, you must set the same AppId for each of the windows. And in this case, the Windows 7 taskbar will group these applications into a single icon. For example, in this case, I set the same AppId for different windows from different applications and these windows were grouped in the Windows 7 taskbar.

    Sample Application:

    Also popular now: