I have a c++ Builder firemonkey application where the main window is the configuration and control and the child window is a full screen graphics display on the second monitor.
I want to know if it is possible to allow the main window to be minimised, without impacting on the child window (child window remains full screen).
Related
I have an application (executable) where it displays an update dialog upon launch in front of the parent window. The dialog, of course, maintains the focus and top of the Z order for the application.
The parent window is therefore unselectable and cannot be moved or dragged etc.
Is there a way to modify the position of windows without focus in an external application?
I'm developing a Application Desktop Toolbar (next Toolbar). Toolbar receives ABN_FULLSCREENAPP notification when a fullscreen application window is opened or closed (e.g. through F11). A window is fullscreen when its client area occupies the entire screen. Toolbar should take themselves out of the topmost z-order so that they do not cover the fullscreen window. For this I use SetWindowPos() with flag HWND_BOTTOM/HWND_TOPMOST.
Problem: On Windows 10 when a fullscreen application window is opened (e.g. Explorer window through F11) Toolbar receives ABN_FULLSCREENAPP and send themselves to bottom z-order. Then, when Win + Tab is pressed, Task View appears. Task View occupies the entire working area of the screen - entire screen exclude the Taskbar area and the Toolbar area. But Toolbar remains under the full-screen window and Takbar appears on top, see image below. I want the Toolbar to also be on top of the full-screen window when TaskVew is open.
During the opening of Task View, Toolbar does not receive any messages. Apparently since Microsoft stopped development of the ADT API, there is no special message for the Toolbars.
Possible solutions:
1) Use the solution from similar question by performing the function in the timer between the opening and closing of the full-screen window;
2) Use LowLevelKeyboardProc() with SetWindowsHookEx().
Both solutions are not elegant. If you know other method of detecting the opening / closing TaskView please report. Undocumented methods are also useful.
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.
I have an application created with LabVIEW and I need to show/hide the application icon on the Windows taskbar at run time.
I think that WINAPI can be used for this purpose and I tried to use the ShowWindow function (user32.dll)
ShowWindow(hWnd,SW_HIDE) -> hides the application window. The taskbar icon disappears for a second than re-appears.
ShowWindow(hWnd,SW_SHOWMINIMIZED) -> It simply minimizes the application window, so the taskbar icon remains
By default a "normal" visible un-owned window gets a taskbar button and the taskbar button is visible in every state except SW_HIDE.
MSDN also documents a couple of tricks you can use to override the button:
The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. 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.
... If you want to dynamically change a window's style to one that does not support visible taskbar buttons, you must hide the window first (by calling ShowWindow with SW_HIDE), change the window style, and then show the window.
Another alternative is to use the ITaskbarList interface, it gives you full control over your taskbar button.
I am trying to implement an edge-docking feature between two NSWindows. When the user moves the window I that can be docked just below the main window I snap it into position and add it as a child window to tha main window. This works very well.
However, I am unable to move the docked window away by simply dragging it. Currently I listen for the NSLeftMouseDragged event and when it starts I undock the window by removing it as child from the main window. This works, but the window is not getting moved. You have to release the mouse button and start a new dragging action to move the window away. I am guessing this happens because when the first drag is initiated the window is sat as a child window and therfore cannot be moved by that drag, even thought it gets released in the mean time.
Is there any way around this?
Thank you