Enable the disabled underlying window - windows

Sometimes in the Windows OS, a program is able to open a new window which disables it's underlying window. Closing the newly opened window of course re-enables the first window. I want to enable the underlying window without closing the newly opened window with Autohotkey.
I made a gif which shows the situation perfectly:
https://imgur.com/a/EWt8OrF
I thought I might be able to pull this off with window styles and window extended styles, so here's what I tried:
^!e::
MouseGetPos,,, WindowUnderMouse
WinSet, Style, -0x8000000, ahk_id WindowUnderMouse
return
But it didn't work. I also did a lot of googling on this, but I didn't know what would be the proper keywords so I didn't find anything. Any idea how to accomplish this?
Some keywords for google:
How to make a modal window modeless
How to enable a disabled window
How to make a palette window
How to make a modal window a palette window
How to enable parent window
Child window disabling parent window
https://autohotkey.com/board/topic/49376-making-a-gui-dialog-modal/
https://autohotkey.com/docs/commands/Gui.htm

Related

After FlashWindow, click the window and the taskbar remains highlight (orange)

When I click the application shortcut, if the program is already open, I will show the program and enable FlashWindow. (FlashWindow(true);)
After blinking once, the taskbar is highlighted.
Theoretically, clicking on the application window would unhighlight the taskbar.
But it doesn't.
There is no problem when the window is minimized.
But it doesn't work when the window is already displayed.
I tried to get all the window handles of the application based on the process id and activated them one by one, but that didn't work either.
For this step I printed the log and used GetForegroundWindow to confirm that the change did happen.
How to solve this problem?
Is there any other way to make the taskbar blink only once without keeping it highlighted?

Detect show/hide Task View (Win+Tab)

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.

Hide/Show the application icon of the Windows taskbar (LabVIEW - WINAPI)

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.

Activating a window while retaining Z-order

I need to activate a window that is possibly behind other windows, but the window should remain behind - it shouldn't be brought to front.
Is there a way to do that? I've tried SetWindowPos with various parameters, but no success so far.
Basically, I need to close a non-active window (by posting WM_SYSCOMMAND with SC_CLOSE), but that window may show a confirmation dialog before closing. If the dialog is shown, it needs to be brought to front, otherwise the window should stay behind.

Hidden window takes all input

I have other application's fullscreen direct-x window, which I need to hide. I found the way to hide it by hooking direct-x create device and changing window parameters so it is not fullscreen. This works ok on XP but on Win-7 I can't use any other application because it looks like application is switching it to be foreground window so all clicks and keyboard input goes to that window. However if I click fast I can make some action. This make me think that this app is using some function to direct input to itself, or to focus, dunno what.
The other thing is that if I resize the window and don't hide it, all works ok.
I tried to hook SetCapture, SetForegroundWindow, SetActiveWindow and SetWindowPos and none of this helped.
Do you have some idea how can I hide window in other way, or what can cause this focusing to invisible window?

Resources