Display On-Screen (Virtual) Keyboard - c#

Is it possible to display/hide the On-Screen keyboard manually from code?

No. It was a design decision (documented here) to give the end user control of the keyboard being invoked. Therefore, the end user has to touch a text box (or the like) to invoke the virtual on-screen keyboard.
From that link:
"The invocation model of the touch keyboard is designed to put the
user in control of the keyboard. Users indicate to the system that
they want to input text by tapping on an input control instead of
having an application make that decision on their behalf. This reduces
to zero the scenarios where the keyboard is invoked unexpectedly,
which can be a painful source of UI churn because the keyboard can
consume up to 50% of the screen and mar the application's user
experience. To enable user-driven invocation, we track the coordinates
of the last touch event and compare them to the location of the
bounding rectangle of the element that currently has focus. If the
point is contained within the bounding rectangle, the touch keyboard
is invoked.
This means that applications cannot programmatically invoke the touch
keyboard via manipulation of focus."

Related

How to get soft keyboard touch event letters using xamamrin android

In a research project I need to obtain the touch event when the user is typing with a soft keyboard. Basically I am implementing the soft keyboard. So I was wondering if there is a way that I can set a touch Listener for the view of the existing soft keyboard and get both the touch event and the text?
The soft keyboard is a completely separate app. You cannot put a touch handler or get any touch input from it. The only way to do what you want is to write the keyboard yourself (or use an open source one and instrument it).

Create a WPF Window that captures AND passes through Mouse Events

I'm working on a screen capture utility that captures active windows. I'm using transparent overlays to capture the full screen and then overlay the active windows based on mouse move events passed through to the underlying desktop/windows.
Both of the overlay windows currently use the WS_EX_TRANSPARENT style to allow mouse events to pass through to the underlying windows so I can detect where the mouse cursor is located. I grab the window handle and rect size to outline the window and then use Global Mouse and Keyboard Hooks to accept or reject a capture.
It's pretty ugly and spread out code (which is why I'm not posting here for now) but it all works very well and I can highlight the windows in mousemove and capture clicks with the global mouse and key handlers.
It all works except for this problem:
The Global Windows Hooks do not fire over an Admin Window so when I want to capture a Powershell, Command or Visual Studio (in Admin mode) Window no hook events are forwarded.
Apparently there's no way to work around this security issues using Windows hooks (or GetAsyncKeystate() for that matter).
I've tried a couple of different approaches to work around this issue:
Instead of using Hooks I tried using the highlight window to capture mouse/key events
This sort of works, but it's clumsy - fails if no window is selected at all (no way to get out) and doesn't allow for selecting contained windows once the parent is selected (ie. no drill down)
I also tried Win32 GetAsyncKeystate() which captures the last mouse or keyboard input and that would work, but it too fails to send mouse or key interactions from Admin windows.
So I have two choices imperfect solutions at the moment: using Hooks or GetAsyncKeyState to get the proper Window browsing selection behavior for all but admin windows, or I can capture all windows but lose the ability to drill into child windows after a parent window is selected.
I'm at the end of my rope and the real question is this:
Is there some way to create a semi-transparent or transparent window that can intercept mouseclicks and pass them on to the window area below?

Can I render a WPF window with buttons on a touch sensitive screen and read the input? Suggestions?

I want to create a WPF window that will display on a touch sensitive screen and the window contains 80 buttons. I want my WPF app to recognize tabs on specific buttons. Do I need any specific API to do that or how will the tabs on the touch sensitive screen be transmitted to my WPF app?
Any suggestions?
Thanks
Windows 7 and its higher versions have the ability to receive input from multiple touch-sensitive devices. WPF applications can also handle touch input as other input, such as the mouse or keyboard, by raising events when a touch occurs.
WPF exposes two types of events when a touch occurs − touch events and manipulation events. Touch events provide raw data about each finger on a touchscreen and its movement. Manipulation events interpret the input as certain actions. Both types of events are discussed in this section.
WPF enables applications to respond to touch. For example, you can interact with an application by using one or more fingers on a touch-sensitive device, such as a touchscreen This walkthrough creates an application that enables the user to move, resize, or rotate a single object by using touch.
Source MSDN : https://msdn.microsoft.com/en-us/library/ee649090.aspx
Also read this codeproject article - http://www.codeproject.com/Articles/692286/WPF-and-multi-touch
WPF applications work on the touch screen without any needs for modifications. Of course you can add support for gestures like pinch-zooming etc. but tapping on buttons works out of the box. For the WPF application it doesn't matter if user is tapping with the finger or clicking with the mouse.

Draw rectangular selection and get corresponding image in WPF c#

I need to write a text recognition (from image) application. The main idea is that while my application is running, I may have the need to transform some text of an image into manageble text. So, in this case with the mouse I need to draw a square around the area that i need to capture and the software must convert the content of the extracted picture into text.
I solved the problem of image recognition. I also find a very easy way to capture from screen.
What I need to do now is be able to select with the mouse the interesting area that is over an other running opplication (for example over a webpage or over an image opened in Paint). That must be like the screencapture on windows7, you create a selection of the screen and this is saved like a picture.
By looking around, I didn't find anything and I don't knwo where to start.
Many thanks
You can achieve that using either a 'tricky' easy way or a real but difficult approach.
The tricky way
Screen Recorder applications usually use this approach:
Whenever user wants to select an area, you display a full screen border less Window with 0% opacity, then user attempts to select the screen area, and he is actually selecting your Window area, so you can receive mouse events and display/draw a rectangular shape to show the selection area to the user.
In this approach, the program needs to know when to display the Window and when to hide it. This can be done by for example defining Hotkeys for capturing:
Program registers a hot key using RegisterHotKey to Windows.
User presses and holds that hot key
Program displays the tricky Window
User selects the interested area, program receives that area using mouse events of the tricky Window
User released the hot key and program hides the Tricky window.
The real way
Using this way, you need to set a message hook in order to receive mouse and keyboard events while user is interacting with desktop not your program. This is not an easy to accomplish approach and I recommend you the first one.

getting mouse information C#

I want to retrieve mouse information to my C# application, the information includes:
when Mouse position changes
When Mouse Clicks
When scroll wheel used or clicked
I have been able to find out how to get the mouse position from this question
, but for other mouse information, I don't know yet. but I do know that I must use win api for that.
UPDATE:
I need the information globally, not over my form or my controls, in fact my form is hidden , I just need to store mouse information during my application running.
Generally individual controls want to know about mouse actions as it relates to them, which is why they have events that capture this information and you should use them accordingly.
However, if you have a need to see this information outside of your Forms then you'll need a global mouse hook. There is an article about that here: http://www.codeproject.com/KB/cs/globalhook.aspx

Categories

Resources