How to hide a window in Windows 7, just like desktop managers do - windows

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.

Related

Controlling an X-Window from a different virtual desktop without entering that X-Window's virtual desktop?

I'm using the XFCE4 desktop environment under Ubuntu 20.0.4.
I have several virtual desktops set up, each of which containing one or more applications which are running.
Is there any way I can run an X-Windows-based command from one desktop and have it manipulate a window in a different desktop, without switching desktops?
For example, suppose I have an xterm shell window running in virtual desktop 0, and that I currently am focused in virtual desktop 0.
And suppose I have a text editor window open in virtual desktop 1.
Is there any way for me to remain focused in desktop 0 and to run a command within the xterm shell window which will send text to the text editor window in desktop 1?
I don't want to see desktops shifting back and forth between desktop 0 and desktop 1 while this text is being sent to the text editor. I want to remain focused in desktop 0 for the entire duration of the running of this command.
I know I can use xdotool to send text to another X window, but xdotool only seems to function when the destination window is in the same virtual desktop which currently has the focus. For example, I can do the following with xdotool, but it won't work unless the destination window (referred to by $windowid in the following example) is in my currently viewed virtual desktop:
xdotool type --window $windowid Sample text
What I want is to send text and mouse clicks to windows in desktops that differ from the desktop that I'm currently viewing, and have the windows in those other desktops receive and respond to the text and mouse clicks without any switch to the other desktops taking place.
If necessary, I'm willing to write a program in C, C++, or pretty much any other language in order to implement this functionality.
But I'm wondering: is what I'm trying to do even possible in an X Windows environment?
Thank you very much in advance for any thoughts and suggestions.
Virtual Desktops:
Most X servers have only a single screen. The window manager may virtualize this resource and offer multiple so-called 'virtual desktops', of which only one can be shown on the screen at a time. There is some variation among the features of virtual desktop implementations. There may be a fixed number of desktops, or new ones may be created dynamically. The size of the desktops may be fixed or variable.
Implementation note
There are at least two options for implementing virtual desktops. The first is to use multiple virtual roots and change the current desktop by manipulating the stacking order of the virtual roots.
The second option is to keep all managed windows as children of the root window and unmap the frames of those which are not on the current desktop.
In any case, you should study the Extended Window Manager Hints.
These properties might be of interest to you:
Root Window Properties:
_NET_SUPPORTED - set by the Window Manager to indicate which hints it supports
_NET_CLIENT_LIST - all X Windows managed by the Window Manager
_NET_NUMBER_OF_DESKTOPS - indicate the number of virtual desktops
_NET_CURRENT_DESKTOP - the index of the current desktop
_NET_DESKTOP_NAMES - the names of all virtual desktops
_NET_VIRTUAL_ROOTS - a list of IDs for windows that are acting as virtual root windows
Application Window Properties:
_NET_WM_DESKTOP - determine the desktop the window is in (or wants to be)
_NET_WM_STATE - list of hints describing the window state
_NET_WM_ALLOWED_ACTIONS - list of atoms indicating user operations that the Window Manager supports for this window
Xlib:
Sending Events to Other Applications (XSendEvent)
Obtaining Window Properties (XGetWindowProperty)
Properties and Atoms (XInternAtom)
Obtaining Window Information (XQueryTree)

How to unhide the cursor without changing the application

I need to do a pre-purchase evaluation of a Flash application that is intended for a touch screen.
Since I still don't have the touchscreen now, I need to run the application on my desktop computer and the application is unusable without a visible cursor.
I am using Windows.
Is there a way to unhide the cursor without asking the developers to change the application?
I've previously used remote access software (such as Windows Remote Desktop or TeamViewer) for this purpose. Another option is a virtual machine - in both cases you'll be able to see the cursor on the local/host machine.
If you happen to be on a Windows 8 machine, you might give a try to the Windows Simulator (http://blogs.msdn.com/b/visualstudio/archive/2011/09/29/first-look-at-windows-simulator.aspx, available for free with Visual Studio Express) that additionally simulates multitouch gestures such as pinch/rotate with only a mouse.
A few other ideas:
1) You can try using the "Show location of pointer when I press the CTRL key" mouse visibility property (Control Panel - Hardware and Sound - Devices and Printers - Mouse - Pointer options). Although not entirely convenient, it might help you if the application doesn't require quick response times.
2) If the application is distributed as a .swf file and the right button hasn't been disabled, sometimes right-clicking (anywhere in the application) to bring up the context menu will cause the cursor to show up and remain visible.

Mac OS X / Open terminal with specified windows *on specified desktops*

The accepted answer to this question explains how to create a "window group" in Terminal.app so that you can open a set of windows with predefined tabs executing predefined commands in predefined positions.
That's great, but it doesn't appear to play nice with Mission Control. I save my window group with the windows spread out across different desktops in Mission Control, but when I restore the window group they all pile up on top of each other in the desktop I'm currently using!
How can I get a Window Group to restore the windows to the desktops from which I saved them?
Thanks!
Doesn't look like separating application windows by desktop is an option anymore; not according to this MacForums thread.
There's an app called TotalSpaces that claims to restore pre-Mission Control window grouping, but it's a paid app so I haven't tried it.
You might be better off asking this question on AskDifferent or SuperUser...

How can I disable / permanently hide the taskbar in Windows 7?

I would like to completely remove the Windows 7 taskbar, including tray and start-button, so that the user can not reactivate it by pressing the Windows-key on the keyboard. however, all other explorer functionality (i.e. starting an explorer Window using Windows+E) should remain.
Is it possible to permanently hide the complete taskbar? Maybe there are some registry values on could change in order to make that behaviour selectable using a powershell script?
Thanks a lot
Here be my solution (it hides rather than replaces or removes the native taskbar - this allows it to work with programs that have a dependency on the native taskbar, such as display fusions taskbar).
disable-taskbar-always-top
Still to solve: [HALF SOLVED]
Eliminate the stupid line that auto-hide leaves with some maximized applications, such as Google Chrome
HALF SOLUTION -
If you move the taskbar to the left or right edge prior to doing the above steps, you don't get the stupid auto-hide line at the top or bottom of Google Chrome. Since the native taskbar is not mouse sensitive anymore, it won't impact your use of hot corners, or multi monitors (for instance I have the native taskbar on the left of my middle monitor, and it does not popup when moving between monitors using the steps in this post).
Okay, I think I have finally - finally - got a workaround that:
Keeps the native Windows 7/8 taskbar hidden for your session (you do have a couple of steps you need to do on start-up each time, or if you manually un-hide the taskbar).
Prevents the native Windows 7/8 taskbar from opening with popups or programs seeking attention (flashing taskbar thing).
Prevents the native taskbar from being mouse sensitive (i.e. despite auto-hide, it will not appear when you mouse over the hidden taskbar anymore).
Allows you to use the screen area that is occupied by the native taskbar (this is the problem of not combining Taskbar-Hide with the autohide setting; you can't use that screen real-estate).
Allows you to run alternative taskbars that are dependent on keeping the native taskbar functional (for instance Dislay Fusions Multi-Monitor Taskbar + [Settings >> Advanced Settings ?> 'Show On All Montiors'])
One Time Steps:
1) Download and run this registry edit to prevent balloon notification popups from the native taskbar/system tray:
Notifications - Enable or Disable Message Balloons - Windows 7 Help Forums
(You can open this in notepad to see what changes it will make prior to installing it, if you want).
2) Download and run Taskbar-Hide from here:
Hide Taskbar: Hide Taskbar in Windows 8 | 7 with a hotkey
3) Set the taskbar to auto-hide
Optional:
3) B) Add a shortcut to Taskbar-Hide.exe in your startup folder, to have it launch automatically with windows on startup (you still need to use the Ctrl+Esc hotkeys to activate the functions of taskbar-hide - though you could also script this if you were really keen).
Startup Folder:
C:\Users{User Name}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Steps to hide taskbar after each start-up or manually un-hiding using Taskbar-Hide
4) Make sure Taskbar-Hide is running.
5) Make sure the taskbar is in its auto-hide state (i.e. you'll have to look at any programs that are currently seeking attention).
6) Once the taskbar is 'auto-hidden', press the hotkeys for Taskbar-Hide (Ctrl+Esc)
[This should mean that the native taskbar area is no longer sensitive to mouse activity]
One way is to replace the explorer shell with your own shell. This is the a common method done in Windows 7 Embedded.
In older versions of Windows (such as XP) it was possible to specifiy a shell for each user via regedit. I am not sure this is easily possible in Windows 7.
See https://superuser.com/questions/352865/how-do-i-change-the-windows-shell-for-only-one-user
Make an empty exe file and use it as the file to use in your "Custom User Interface" group policy. Additional information here.
I have found another solution that works nearly perfect for me, by just hiding the Taskbar and the Start button by simply sending both the WM_HIDE message:
Handle = FindWindow("Shell_TrayWnd", "");
...
ShowWindow(Handle, SW_SHOW);
The only problem I have with that solution is that the taskbar is not hidden permanently, i.e. as soon as one element is activated that does not have the focus, which on the taskbar leads to the item flashing in yellow, the taskbar gets visible again.
I'm not sure if there is a way to prevent Windows from re-enabling the visible flag of the taskbar in some way, or a method to hook to the SW_SHOW in C# though.

Does Windows 7 treat full-screen applications differently?

I have a hidden process that waits for non-standard hardware button messages and runs an application (with CreateProcess). No problem with the user disturbing, it's an action that the user approved himself. Everything is fine when it's usual layout with taskbar shown and multiply captioned and non captioned- windows. But the situation is different in XP and 7, when the current application is full-screen. Full-screen application in this case is window without borders having exactly the same dimension as the screen. Windows hides taskbar for such application even if it's always on.
In Xp, it's ok, the taskbar is being shown in this case and appication (for example calculator) also, the full-screen app is still visible in areas other than the launched app's and taskbar'. But in Windows 7 nothing visual happens, the full-screen app is still on and if I switch to taskbar, the executed application is there. I tried to solve it with SetForegroundWindow, BringWindowToTop, even AllowSetForegroundWindow(GetCurrentProcessId()) call for a window handle found with CreateProcess-WaitForIntputIdle-EnumThreadWindows, no change. So did something change since XP related to full-screen windows that officially documented?
Thanks,
Max
I would imagine that, if you have your own hardware device, that there is some API for generating "real" user input. Clearly the legacy keyboard and mouse, and now USB HID drivers (many of which are usermode I think?) have access to an API to do so.
Synergy+ for example can generate fake keyboard and mouse events on connected PCs, and the consequence of the faked input is windows switching activation normally.
So, my initial idea is for your usermode "Device" application to synthesize actual keyboard messages - SendInput seems a likely candidate for "the API that can "fake" real user input events.
Then, use an API like RegisterHotKey in your "UI" app to respond to the hotkey combination your device app generates.
Now, (assuming that SendInput IS generating user input events at the correct level), you should (from within the WM_HOTKEY handler in your UI app) have permission (because everything was "user initiated") to change the foreground window (to yourself).
Vista introduced the desktop composition feature. In short, all windows are drawing to a memory bitmaps and the Desktop Window Manager is then composing these bitmaps and drawing on a full-screen Direct3D surface. Full-screen windows do not participate in the desktop composition and get to draw directly on the screen (mostly because the majority of full-screen apps are games that need real-time screen updates).
In particular, this means that when a full screen app is up and running, it is covering the DWM composed image and the user needs to switch to a DWM-managed window for the DWM to start drawing on top of the full-screen app.
I don't have a good solution for your problem, unfortunately. One way to solve it would be to add the WS_CAPTION style to your app and then handle WM_NCPAINT/WM_NCCALCSIZE/WM_NCHITTEST yourself. This would allow you to lie to the DWM that you are a regular windowed application, but change visually your NC area to look like you have no title. However, this does require certain amount of additional code and might be a bit more effort you want to invest.
Another way you can try to solve your problem is to explicitly minimize your full-screen application window when launching the new process. However, you will then have to solve the problem of when to maximize it back again.
Btw, you might find the comments on this post from Raymond Chen interesting.
Windows supports multiple desktops and my guess would be that the full screen up is using a different desktop than the default one (where your application will be shown). A desktop object in Windows is "a logical display surface and contains user interface objects such as windows, menus, and hooks". For example, screen savers normally are started on a separate desktop.
You can find out which desktop an application is running on using Process Explorer:
Set Process Explorer to replace Task Manager and to run always on top.
When your full screen up is shown, launch Process Explorer by pressing Ctrl + Shift + Esc
Within Process Explorer, select the full screen process and press Ctrl + H to display the handles of this process
See the value of the Desktop item in the list. Usually this would be set to Default
If you know what desktop this app is running on you can start your process on the same desktop by first calling OpenDesktop to get a handle to this desktop and then pass it into the STARTUPINFO of your CreateProcess call.

Resources