WPF on Windows 7 with touch: hide touch cursor - c#

I have a WPF application that, due to hardware constraints, has to run on Windows 7 Standard Embedded. The device is touch enabled and I am taking advantage of that in the way that I am building the application.
One of the problems that I have is that whenever the user touches the screen, a small "pointer" appears showing where the user has touched. This can apparently be turned on and off at a system level (http://windows.microsoft.com/en-US/windows-vista/Turn-the-touch-pointer-on-or-off) however ideally I want to turn it off at a WPF application/form level so that the user is not having to disable and enable the cursor each time they go in and out of the application.
Does anybody have any ideas as to how this can be achieved? I have tried searching various combinations of Windows 7, Touch, Pointer etc. but bar the above article I only ever seem to come back with how to enable touch events.
I should also point out that the hardware constraints currently rule out any option of upgrading to Windows 8, 8.1 or 10 so please do not consider this in any answer you may have.
Thanks.

Set the following properties of the Window to false...
Stylus.IsTapFeedbackEnabled
Stylus.IsTouchFeedbackEnabled
Stylus.IsPressAndHoldEnabled
Stylus.IsFlicksEnabled
They are probably not all required; but this worked for me.

Related

How to programmatically add/modify/delete available display settings (width, height, refresh rate)?

I want to code (in C#) a tool to add/modify/delete some of the available Windows display configurations (width, height and refresh rate).
Can this be done programmatically? I've spent many hours trying to find something about this online but had no luck.
The reason i want it is because of some older full screen games that keep setting the refresh rate back to 60hz from whatever it were when the game started (120hz in my case). I can solve that problem using Alt-Tab twice but I rather want to just limit the available display configurations (or change the refresh rate for some of them) instead.
Before considering all this I've tried to solve my problem with these attempts:
Intercepting the keyboard (using this class Global keyboard capture in C# application) and then attempt a force display change when a hotkey it pressed. It works fine for just about all normal apps. But when a full screen game is running the keydown event doesn't fire. Either it is not possible when a full screen game has focus or I don't just know how to do it properly (very likely as I am a newbie in that regards).
Tried using a timer to periodically check for a certain resolution and if 60hz is detected then try to set it to 120hz. The timer does fire and the code tries to change the monitor (which flickers briefly) - but the refresh rate doesn't change.
Another idea I had was to use Mhook or Detours to intercept the 'change display setting'-call. But I don't know if that'll work. And I also have no experience with C++. So I really don't want to go that way if I can avoid it.
Can this be programmatically? I've spent many hours trying to find
something about this online but had no luck.
This settings are not part of the standard .Net Framework but there is interface to manipulate these settings for windows problematically using win32 APIs. you can look here on how to call windows APIs using .Net Framework. then you can call a windows API to change the resolution for instance.

How can a screensaver continue to draw over the desktop in Windows 8?

I’m developing a screen saver in C# .NET4.0 on VS2010 which needs to do a fair bit of processing before it actually shows screens (fairly complex database access). This is fine because the user is unaware that this processing is going on and then the full screen forms kick in when everything is ready. That is, unless we are running on Windows 8.
Searching on the Microsoft Community (http://answers.microsoft.com/en-us/windows/forum/windows_8-desktop/bubbles-screensaver-has-black-background/e0807324-5ca6-4abe-b6ba-716848b41ff5?page=4) reveals that a design change was made in Windows 8 that prevents screensavers from drawing over an image of the desktop. Any screensaver that previously drew over the desktop will instead draw over a plain background using your chosen “metro” background colour. Experimenting reveals that this background kicks in immediately the .scr file launches i.e. before any forms can be displayed. Hence tricks like displaying forms minimised or with 0% opacity don’t work because this simply reveals the plain background underneath.
The best I’ve been able to come up with is to display full screen plain black forms as first action when my code starts i.e. before any database processing or other screen construction takes place. Why try to replace a plain screen with another plain screen? Well, because the default Windows background colour seems to be blue. That’s blue as in BSOD blue which looks kind of alarming when it kicks in. So the best I can do for a Windows 8 user experience is a quick flicker of blue followed by 3-4 seconds of plain black before screens are populated with something meaningful.
This new behaviour from Microsoft is apparently “by design”. The fact that it doesn’t manifest itself in Preview mode is apparently an error which one supposes MS will tidy up later.
So my question is does anyone know any way around this so that I can continue to have the desktop showing until screensaver forms are ready to kick in?
I struggled quite a lot with a similar problem regarding this awkward design decision in win8.
I the end had to compromise but my search continues for a a bullet proof solution, when I have time.
Now what I ended up with is running a batch file after the monitoring system starts and have thread detect idle time and run that batch again.
#start /wait Bubbles.scr /s & rundll32 user32.dll,LockWorkStation
What this does is:
starts screensaver preview in fullscreen (this works in win8) and waits
on user action lock screen is show and user prompted for password
As I said it's a compromise until a find something better. Hope it helps
Updated to win10; try to use that cool scr and found same issue;
Try to trick ms restriction and found only one very long solution:
enable logging of screensaver invoked events;
here instruction via gpedit: https://superuser.com/questions/538146/run-a-batch-cmd-upon-screensaver
now you will able to start other comand or app when screensaver starting;
goto C:\Windows\System32
copy Bubbles.scr and rename to Bubbles.exe
then config task to run C:\Windows\System32\Bubbles.exe with argument /s (administration->taskcheduler)
use some windows screensaver and config to use 1 min or more; (or use 'runsarver' with empty options from upper link or create your own empty.exe and rename to .scr and install with right menu, etc)
Found cool app to customize hidden screensaver features: http://winaero.com/download.php?view.8
(work with small bugs but work as needed under win10)
All work fine one cons checkbox to lock PC must be unchecked;
If needed create own app to run Bubbles and on exit lock PC or bat file as above, etc;
hope people will have fun with my solution :)

C# - Transparent Window to defeat Keyloggers

How can I create a window which is fully apparent to the user but is not visible in screenshots. I know that this is possible since Neo SafeKeys (an onscreen keyboard to defeat keyloggers) does not appear in the screenshots taken by keylogging software I installed.
To give you an idea, the window is fully visible to the user, however when a screenshot is taken, the Neo SafeKeys window does not appear at all (as if it does not even exist).
Neo SafeKeys states that it uses an invisible protection layer above the window to protect against screenshots. I have searched all over the internet to see how can I reproduce this, to no avail. Does anybody know how this can be performed (windows which is visible to user but invisible in screenshots)?
What you can do is you can prevent the PrtScn key from doing anything when pressed. Take a look at this article while shows you how to do this.
What this article is doing is clearing out the clipboard. What you can do instead is capture the screen image and digitally remove your application, then put the revised image on the clipboard, thus giving the "Effect" of making your window transparent.
Also, you might want to look at this SO question which gives an alternative way to make your window just appear "blue", though its not easy to do.
Does anybody know how this can be performed (windows which is visible to user but invisible in screenshots)?
Use DirectX to render directly to the device.
In your C# application you can set up a global hook to monitor keyboard events. Then your application becomes the global handler for print screens. Now if another application managed screen prints natively, can't stop that, but anything running through windows, you can get at.
The WM_KEYBOARD_LL hook is one of the few global hooks that can be used in managed code because it doesn't require a DLL to be injected into every target.
For some code you can visit here:
Adam's Blog
Keep in mind that these are global hooks so you want to make sure nothing else (other applications) are effected. I've used these in the past as we hosted showing a power point in an application we worked on. Basically we didn't want the user to invoke any powerpoint menus or keyboard short cuts so we used a global hook. We always checked to see whether the users was in a certain area (screen) and in our application, otherwise we would effect other applications functionality (including our own!)
Microsoft Information:
Hooks Overview
There's this.....
visual cryptography
live example here
But this could be easily coded against by taking multiple screenshots and laying them overeachother and such...
If you are using Windows, and you can avoid that screenlogging happens, you can implement a nice solution like a virtual desktop to embed your process into it. When a process is running inside a virtual desktop it is possible to bypass an screenlogger tool that runs over win32 Api.
Check out this article so you can sneak a peek how to implement a nice solution to scape from screen and keyboard monitoring.
http://www.codeproject.com/Articles/7392/Lock-Windows-Desktop?fid=62485&select=3139662&fr=101#xx0xx

Launch WinForm application Aerosnaped Right Aligned

This should be a simple question, but search-foo has failed me. My goal is to detect that I'm running under Aero (Vista or Windows 7) and have my application Aerosnap by default. (It turns out that a corporate application I wrote is run by pretty much everyone aerosnapped right, with their Outlook snapped left.)
The application is WinForms and I'm currently doing
Width = Screen.PrimaryScreen.WorkingArea.Size.Width / 2;
Height = Screen.PrimaryScreen.WorkingArea.Size.Height;
Top = Screen.PrimaryScreen.WorkingArea.Top;
Left = Screen.PrimaryScreen.WorkingArea.Left +
Screen.PrimaryScreen.WorkingArea.Size.Width / 2;
in my forms's load event. This works great, except that if they use WindowKey+Arrow, it acts as if it was just a normally located form. This means WindowKey+Right does nothing on first press and WindowKey+Left snaps left. This isn't a major problem, but I would prefer if I could specify a window size and then snap the application to the Right so those keys act as they would with any other application.
I'm not sure this is possible, here are the things I did find:
Save and restore Aero Snap position on Windows 7
Handling AeroSnap message in WndProc
These seem to indicate that there is no special AeroSnap message available. Anyone know otherwise?
Not sure why checking for version wouldn't get you most of the way.
How to determine the Windows version by using Visual C#
http://support.microsoft.com/kb/304283
This might get you the rest of the way. http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/1a82ec8d-afc3-4eba-8189-6ee105aa6249

Detecting raised-event at OS-level (OS Appearance)

I have what seems to be a common problem. I am running Windows 7 Home Premium on one of the most awesomest computers (when it was bought last year) and certain visual effects just automatically turn themselves off.
My average user experience rating is high, so it doesn't explain why this happens. The only feature that ever gets turned off is the 'Show window contents while dragging' option. And it really annoys me.
There are currently no working solutions to this problem online. Other than to "there must be a conflict with another app installed on your machine."
And yes, I do know what app is causing this conflict. It's my bloody Internet Provider's software - you know... that app that you absolutely MUST have open at all times when you're connected to the net.
So, I had a thought. What if I could subscribe to an event so that my app that runs in the background will detect when this 'show window contents while dragging' option is turned off - and then my app will simply turn it back on again.
When I do this manually, it seems to stay in effect for about an hour or two, then it gets switched off again.
Is it possible to handle these types of events, and re-start certain visual effect features? If so, are there any resources on this?
I have not been able to find anything on this sibject yet.
Yes the WM_SETTINGSCHANGE message is sent to all windows when a system setting is changed. Then you can call SystemParametersInfo with SPI_GETDRAGFULLWINDOWS to determine if the "Show window contents while dragging" is disabled and use SPI_SETDRAGFULLWINDOWS to enable it.
So all that you will need to do is create an application with a form (that can even stay hidden) and override the forms WndProc and handle the WM_SETTINGSCHANGE message and call SystemParametersInfo using p/Invoke. The p/Invoke definition for SystemParamtersInfo is available at pinvoke.net
Altough what may be easier is change security on the HKCU\Control Panel\Desktop\DragFullWindows registry value so that it can't be changed.

Categories

Resources