My program opens multiple windows on taskbar (not MDI). I want to display a Jumplist that is specific for each Window. How is it done?
Windows uses the Application User Model ID to group taskbar buttons and jump lists. This lets you group multiple processes together, or in your case split multiple windows from the same process.
You can assign a different AppUserModelID to a window by using the SHGetPropertyStoreForWindow() function to obtain the window's IPropertyStore interface and then set its System.AppUserModel.ID property.
Related
Two use-cases:
Enumerate windows and then get the process handle for each window
Enumerate processes and then get the main application window handle for each process
Enumerate windows and then get the process handle for each window
You need these APIs:
win32gui.EnumWindows() to enumerate all top-level windows (that is no child windows aka controls)
win32process.GetWindowThreadProcessId() to get process ID from window handle
win32api.OpenProcess() to get process handle from process ID
Enumerate processes and then get the main application window handle
for each process
You need these APIs:
win32process.EnumProcesses() to enumerate all processes
win32api.GetWindowLong() with argument GWL_STYLE to get window styles and GWL_EXSTYLE to get extended window styles
win32gui.GetParent() to determine unowned windows
By filtering the result of EnumWindows() using GetWindowThreadProcessId() you can get all windows that belong to a given process.
Determining the main window can be tricky as there is no single window style that would designate a window as the main window. After all, an application might have multiple main windows.
Best you could do is to use the same rules that the taskbar uses to determine application windows, because that's what the user perceives as main windows:
The Shell places a button on the taskbar whenever an application
creates an unowned window—that is, a window that does not have a
parent and that has the appropriate extended style bits.
To ensure that the window button is
placed on the taskbar, create an unowned window with the
WS_EX_APPWINDOW extended style. To prevent the window button from
being placed on the taskbar, create the unowned window with the
WS_EX_TOOLWINDOW extended style. As an alternative, you can create a
hidden window and make this hidden window the owner of your visible
window.
Use GetParent() and GetWindowLong() to determine the unowned windows that have the right window styles according to these rules.
To access and control a window, dialog or popup with Autohotkey the title of that specific window is needed. For some windows the title can be read directly if its visible, but some windows hide it. The window class and the exe (ahk_class and ahk_exe) aren't visible at all. How to gather this information reliable?
Use the Window Spy tool, which is installed together with AHK, it can be started various ways:
Right click the tray icon of a running AHK script and select Window Spy
Start the AU3_Spy.exe in the AHK installation folder
Use the Windows search to search for Window Spy
You will get a window called Active Window Info with various infos about your current active (topmost) window. The first box is the one you need.
Example
The box gives title, class and .exe to detect the target window of which every line can be used to identify the window. Now you should activate the window you want to address and copy the information.
Hint: You can (un-)freeze the display with Win + A
I want to make a new group for windows in Windows XP taskbar. I would like to move windows from one group to another, how can I do this?
Here is image of one group which has 7 windows:
What I want to do is move out some windows into its own group.
What you are asking for is not officially supported in XP. The grouping is controlled by the OS based on the executable of each running process. Multiple instances of the same executable are grouped together. There is no option to change that behavior, only to enable/disable it in the Control Panel settings. If you want to manipulate groups, you have to do so manually using the Toolbar API and undocumented data structures, as outlined in this article: Manipulating Taskbar Buttons (use at your own risk).
The feature you are looking for is officially supported in Windows 7 and later by using Application User Model IDs instead. Windows that are assigned the same AppUserModelID are grouped together. Use SetCurrentProcessExplicitAppUserModelID() to set a process-wide AppUserModelID. If an app (like a legacy app) does not assign a process-wide AppUserModelID, the OS auto-generates one. The process AppUserModelID is used as the default when creating windows. A window-specific AppUserModelID can then be assigned using SHGetPropertyStoreForWindow() and IPropertyStore::SetValue() if needed. This allows a single process to have multiple taskbar groups, and multiple related processes to use a single shared taskbar group.
my system is Win7 Ultimate 32bit, and my taskbar buttons group poliy is "Always combine, hide laybels".
There is one program that have some shortcuts, when I open that program by clicking different shortcuts, I found that the icons didn't combine as the policy says.
All these shortcuts are targeted to the same position.
Can anyone tell me why this happen and how to combine all these icons?
Thanks
PS:The system says that I am a new user and have no right to post images....
Applications do have some control over their taskbar appearance but the shortcut used to start them also matters. If one shortcut specifies a App Model Id and a different shortcut does not (One you created perhaps?) then Windows might decide that these are two different apps (Or the same app with separate "modes")
If the application does not call SetCurrentProcessExplicitAppUserModelID then the auto generated Id might also not match if you run 32 and 64 bit versions of the same app...
When I install a virtual desktop manager on Windows 7, and I switch to a different virtual desktop, all the current windows disappear, also disappearing from the Start Menu.
I want to hide some of a particular application's windows, but not all of them, in a similar manner. How can I hide a window like this?
In particular, I need to hide a VirtualBox Seamless mode window, so I'm not sure minimizing the window will work. It does, however, disappear when using virtual desktop managers.
The same window cannot appear on multiple desktops. If you need your application window to appear on multiple desktops you need to create a separate window for each desktop. The desktop a window appears on depends on the thread that creates the window. You can change the desktop thread assignment using the SetThreadDesktop function.
The answer is simply ShowWindow(SW_HIDE) and ShowWindow(SW_SHOW). I think "Virtual Desktop Managers" just hide windows and show them as necessary when the desktops change.