Accessing second monitor in WPF when monitor setup set for "Show Desktop Only On 1" - wpf

I'm writing an application that will be run on a windows 7 system with a monitor and a front panel as a dual screen setup. Virtual desktop software will be used to access it most of the time, and the virtualization software should ONLY show what is on the monitor, not the front panel.
When set for "Extend these displays", the virtualization software shows both screens spliced together, and there does not appear to be a way to turn it off. If I set the Multiple Displays setting to be "Show Desktop Only On 1", the virtualization system works correctly, but now in my WPF application it's as if the second monitor does not exist. My Screen.AllScreens array only shows one monitor.
Is there a way I can get my WPF application to show on the second monitor in full screen mode when the desktop is set for "Show Desktop Only On 1"? For purposes of this application, it will ONLY ever be full screen.

You are approaching the problem from the wrong angle. You need to look at the virtual desktop software and not your app or Windows itself.
First off, for Windows to use dual screens, which you want, you must set "Extend these displays". Without this, it is impossible for Windows or any other software to use the second display.
Secondly, under "virtual desktop software" I assume something like Remote Desktop, TeamViewer or VNC. All of those programs should allow you to select whether to show all displays. For instance in Remote Desktop, before connecting you can select Options -> Display -> uncheck "Use all of my monitors for remote sessions".
If on the other hand you are looking for a way to limit the end user, that he/she couldn't in no way access or see the other monitor, then you must find a virtual desktop software that can only show the main display (this might be very hard, because most software can handle multi-display setups). The other solution is to extend your own software to stream it's main screen output to another machine and accept input from it - think of writing your own virtual desktop software.

Related

Moving window from remote desktop screen to local desktop

I don't know if the title is clear, but I'll explain what I'm trying to do.
I am using Cisco and RDP to be able to access my office computer remotely. When I first used it, I was able to have one one monitor my remote desktop and on my computer, I have my local desktop. I was able to move a window from my local desktop to the monitor and move a window from my remote desktop to the screen of my computer.
However, now, I'm not able to do it anymore. I'm able to move a window from the local desktop to the monitor, but if I try to move a window that I opened in the remote desktop to my computer screen, I'm not able to do it. The window stops at the edge of my monitor and it does as if the monitor was the only screen available.
I tried the display option: "Use all my monitors for the remote session", but what it does is it goes full screen on both my monitor and computer, and I can't see any windows I opened in my local desktop. I have to exit the full screen to be able to see the windows.
So, is there a way to see both desktops, one on my monitor and the other on my computer, and be able to move windows between the screens?
Thank you in advance for your help.

Keyboard shortcut to toggle OUT of a Citrix Workspace Desktop Viewer session

Background
I'm using the Desktop Viewer functionality in Citrix Workspace (version 20.2.0.25(2002)) to access my work computer from my home computer.
Request
I would like to be able to toggle out of my (full-screen) remote session back to my local desktop more easily.
Currently I can only accomplish this via the control bar at the top of the remote session screen which is starting to feel tedious.
Alt+Tab doesn't work, because it only toggles the applications within the remote session when the session is open.
Whether toggling is accomplished via getting Alt+Tab to work as desired, a hotkey that just minimizes the session window, or some other method doesn't matter to me.
What I've Tried
There are many questions online addressing how to enable Alt+Tab within the remote session, but not disable it. Naturally I've tried to do the reverse of these instructions but no luck. They typically suggest setting TransparentKeyPassthrough=Remote in the registry of the local machine, so I figured mine should have Remote already and I would just need to clear it or replace it with something else, but mine is a null value.
I've gone through all options within Citrix Workspace and the Remote session Preferences but there's nothing about enabling/disabling/setting hotkeys.
I tried the "Disable Hotkeys through the ICACLIENT.ADM Template" of this Citrix Support page, but was unable to locate the icaclient template file they refer to.
I've contacted my company's help desk but they don't know of any solutions.
You can access the citrix menu as described here:
As an accessibility feature of the Desktop Viewer, pressing CTRL+ALT+BREAK
displays the Desktop Viewer toolbar buttons in a pop-up window.
So the shortcut for toggling out of the viewer session would be:
CTRL + ALT + BREAK, CURSOR-DOWN, ENTER
I had the same problem and solved it with an Autohotkey script. Autohotkey can intercept keypresses even when citrix has focus.
This script will allow you to get out of your citrix session with Ctrl-F1.
^F1::
WinMinimize, A
return
If you have not used Autohotkey before: Download Autohotkey, install it, save the code above in a file named citrix.ahk, double-click that file. The hotkey is now active and the script is visible as a H icon in your taskbar.
See here if you want to bind a different key.
Unable to comment on ht13's answer so i'll post my own.
CTRL+ALT+BREAK, h
worked for me.
Thankfully i remembered some keyboards have BREAK, some (like mine) call it PAUSE in case you run into that too.
I have a method for this that involves editing the registry on your local machine.
It definitely counts as 'some other method' - essentially, it sets up a keyboard shortcut that (I think) passes the Win-key keystroke to your local machine.
This opens your local start menu on top of Citrix - and from there you can Alt+Tab locally as normal.
Citrix has multiple entries in different parts of the registry, and also some settings that you can change with the Local Group Policy Editor (gpedit). Unfortunately, the only one I've found that helps is 'Hotkey13', which is only available in the registry.
I've changed multiple things, but I believe the minimal necessary steps are this:
open regedit, and navigate to Computer\HKEY_CURRENT_USER\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Client Engine\Hot Keys\
ensure the value of AllowHotkey is set to 1
set the value of Hotkey13Shift; I've used Shift, if I recall correctly it accepts Ctrl and Alt and some combinations joined by +
set the value of Hotkey13Char; I've used F1, and think it accepts all Fx keys and possibly some others
restart Citrix, reconnect to your remote desktop, and test your chosen combination
Now, to access my local machine from within a Citrix session I press Shift+F1 to open my local Start menu and give focus to my local machine, and then while it is open Alt+Tab or anything else acts locally.
A screenshot of regedit highlighting Computer\HKEY_CURRENT_USER\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Client Engine\Hot Keys\Hotkey13Shift
this bothered me for so long and I finally got a fix: (AHK+Virtualdesktop)
put your citrix desktop viewer in a different virtual desktop
install AutoHotKey and Windows-desktop-switcher
https://github.com/vnavkal/windows-desktop-switcher#:~:text=An%20AutoHotkey%20script%20for%20Windows%20that%20lets%20a,desktops%20by%20hotkey%2C%20etc.%20%28see%20Hotkeys%20section%20below%29.
define whatever hotkey you want to use to toggle between different virtual desktop.
it seems the AHK is able to intercept the hotkey BEFORE it is send to the Desktop Viewer.
my setup:
I use a windows desktop and 2 extra display
I put citrix on virtual desktop2, and fullscreen to all 3 screens
use the hotkey to toggle back to laptop host window virtual desktop 1 without any problem.
FN+F11 toggles out to my windows taskbar. Just need to click on the citrix icon on the task bar to go back again.
Press Ctrl+Alt+Fn+B and then W for switching to window or F to get Citrix in full screen mode. A bit faster then using arrows ...
Using SHIFT + F2 you can resize the Citrix window and access the local machine taskbar so that you can easily switch between the apps.
Refer to this link: CTX232298.
I place citrix workspace on separate windows desktop, and use CTRL + ALT + BREAK and then CTRL + WIN + LEFT/RIGHT to switch from it to another desktop.

Server Remote Desktop

I am helping a friend out with his new startup and he is looking into the possiblity of buying a server. A big part of the business involves running scripts to test various programs. The scripts automate mouse movement and clicks and keyboard inputs, basically mimicing a human user and logging how to program responds.
I understand that using virtualization, he could have one server running multiple instances of the operating system simulatnously. Unfortunately I don't have any experience with this.
What we would need to do is as follows:
Open an instance of remote desktop instance on the server through a laptop.
Run one of the automation scripts and watch the mouse move around the screen doing its work
Close the remote desktop on my laptop but leave the script running with the mouse moving around the virtual screen doing its work
Open 10 more instances of remote desktop to do the same thing
Login to each remote desktop a week later and check the progress
Basically if I close an instance of remote desktop, is there a way to keep the automated mouse movement script running?
Is there a limit to the number of instances that can be run at once?
I'd be greatful if someone could point me to some instructions on how this would work? As you could probably guess neither of us are IT experts! Thank you

Avoiding all system messages and messages from other software

Here is the situation. The company I work for builds this piece of software in c that can make a Windows computer act a bit like a TV. Essentially, our piece of software is meant to be played full screen and content is displayed from the internet without the user having to ever touch the computer again.
The problem is that once in a while, the system brings up pop-ups like "Your Windows system is ready for an upgrade." or "Please renew your Norton subscription" etc. which the user has to periodically and manually remove.
Is there a way to display content full screen without being bothered by those warnings?
Yah, whether or not the development community agrees, Microsoft has several standards for when and why it might be acceptable to have exclusive use of the monitor.
The most official strategy is to use DirectX in exclusive mode. This is what games do, what windows media player does in full screen video with hardware acceleration enabled, etc... If your application is multimedia intensive (as suggested by TV like functionality), you should probably be using DirectX too. Besides giving you the exclusive display access it will also increase your applications performance while lowering the CPU load (as it will overload graphics work to the video card when possible).
If DirectX is not an option, there are a great number of hacks available that seem to all behave differently between various generations of windows operating systems. So you might have to be prepared to implement several techniques to cover each OS you plan to support.
One technique is to set your application as the currently running screensaver. A screensaver if really just an EXE renamed to SCR with certain command line switches it should support. But you can write your own application to be such a screensaver and a little launcher stub that sets it as the screensaver and launches it. Upon exit the application should return the original screensaver settings (perhaps the launcher waits for the process to exit so that it returns the settings in both graceful exits and any unplanned process terminations ie: app crash). I'm not sure if this behavior is consistent across platforms though, you'll have to test it.
Preventing other applications from creating window handles is truly a hack in my opinion and pretty bad one that I wouldn't appreciate as a customer of such software.
A constant BringWindowToTop() call to keep you in front is better (it doesn't break other software) but still a little hack-ish.
Catch window creation messages with a global hook. This way you can close or hide unwanted windows before they become visible.
EDIT: If you definitely want to avoid hooks, then you can call a function periodically, which puts your window to the top of the z-stack.
You could disable system updates http://support.microsoft.com/kb/901037 and remove the norton malware.
You could also connect a second screen so that the bubbles appear in the the first monitor.
Or you rewrite it for linux or windows ce.
One final option is to install software that reconfigures your os into a kiosk http://shop.inteset.com/Products/9-securelockdown.aspx
If you don't need keyboard or mouse input, how about running your application as a screensaver?
A lot of thoses messages are trigged/managed by Windows Explorer.
Just replace it with your dummy c#/winform.
By changing the registry value
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"Shell"="Explorer.exe"
You can specify virtually any exe as an alternative to explorer.exe
That's the way all windows based (embedded) system (ATM & co) do.
There's still few adjustment (disable services you dont need / dr watson & others), and of course, you'll want to keep a "restart explorer.exe" backdoor.
But that's a good start

WPF application visiblity afte remote desktop

i have a WPF application that sits on top of all other windows. 99% of the time it works perfectly however if i dial into my computer from another location using remote desktop and then close the connection and go back to the original computer, my application is not visible. checking the running processes i can see that it is still running however its not visible at all. I assume it has something to do with the remoting but i was wondering if there is some code i can run say every 20 seconds that sits on its own thread that checks whether it is visible and if not will execute some code whether by pInvoke or .NET to become visible again. Any ideas?
Make sure to upgrade to .NET 3.5sp1. There were some changes with remoting which lead to WPF applications being sent as bitmaps in remote desktop in all situations.
In earlier versions of the framework, there were problems with WPF applications causing very odd behavior when combined with remote desktop.
Another idea - make sure you're using the latest and greatest versions of your graphics drivers from your graphics card vendor. WPF makes heavy use of DirectX, and this could potentially be a driver bug preventing the context from resetting appropriately.

Resources