how to change language of Virtual Keyboard in C# or VB? - c#

I want to change language of OSK in my Project when show.
How can I do it?
This is my code:
Private oskProcess As Process
oskProcess = Process.Start("osk")

I think OSK can't do this, but TabTip can.
Maybe this will help you.
Private tabtipProcess As Process
tabtipProcess = Process.Start("tabtip")
and read this article, tells about how to control tabtip. It may be usefull Start TabTip with numpad view open

Related

Is there any way to use WinForms to create a "dock"-like app that is able to open additional windows?

So, I am trying to work on an program that uses an interface similar to other programs like RocketDock, etc. When the program is running, it should appear as a vertical dock with not borders or anything. Inside the "dock" would be a collection of icons that each open a window besides the dock. Inside the window, different functions could be performed depending on the which icon was clicked. I'm thinking I can do something like this with WinForms, but I wanted to create something that is persistant on the desktop as long as the program is running. Would this be possible in WinForms? Is there a library or something that would help me out?
I made a quick sketch of what I'm talking about. I'm hoping this can help clarify what I mean.
example sketch
I don't really have much working right now. I'm still trying to figure out a starting point.
Check Spy++ https://learn.microsoft.com/en-us/visualstudio/debugger/introducing-spy-increment?view=vs-2019 to use as a tool to learn all the window styles on the product you use for inspiration.
Check if using System.Windows.Forms.Form.CreateParams is enough to augment the window that will be created (override it in your derived Form class), for example:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override CreateParams CreateParams
{
get
{
var r = base.CreateParams;
r.ExStyle |= 0x88;
return r;
}
}
}
see styles information here:
https://learn.microsoft.com/en-us/windows/desktop/winmsg/window-styles
https://learn.microsoft.com/en-us/windows/desktop/winmsg/extended-window-styles
Topic is so big that it will require you to do a lot of research to get to the result you need, but this should provide a good start.
It is also worth noting that P/Invoke allows you to call almost any Win32 function to use Windows behavior that isn't available through .NET APIs.

Open On-Screen Keyboard for Xamarin/Monogame

I'm developing a game using Xamarin/Monogame and I need to open the keyboard on a mobile device when they click on my input control. I recognize that I can capture input using Keyboard.GetState() when I'm using the emulator and my keyboard, but real users will have physical devices, and I need to open the on-screen keyboard for them to enter in information. I don't see anything in any documentation describing this, but it's hard to believe I'm the first person to run into this. I've looked through Xamarin/Monogame's docs on input and I've read this StackOverflow article. Let me know if you need more information to help solve this. Thanks in advance for any help.
After much digging I was able to figure out the solution. I'll first start by explaining how I got there:
I stopped thinking "how do I display the on-screen keyboard in Mono?" and started thinking "how do you display the keyboard on an Android device?" This lead me to this article which was perfect; Xamarin and Android. Here's the relevant snippets:
Showing the soft input (on-screen keyboard)
var pView = game.Services.GetService<View>();
var inputMethodManager = Application.GetSystemService(Context.InputMethodService) as InputMethodManager;
inputMethodManager.ShowSoftInput(pView, ShowFlags.Forced);
inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
Some key notes about this:
The View class is Android.Views.View
The InputMethodManager class is Android.Views.InputMethods.InputMethodManager
This code is called from within an Activity class, so Application refers to a property on that class (this.Application)
game is your game class (in Mono) that is of type Microsoft.Xna.Framework.Game
Hiding the soft input (on-screen keyboard)
InputMethodManager inputMethodManager = Application.GetSystemService(Context.InputMethodService) as InputMethodManager;
inputMethodManager.HideSoftInputFromWindow(pView.WindowToken, HideSoftInputFlags.None);
After I solved this, the way I was capturing input (the XNA/Mono way) was not capturing this input. So I had to continue digging. While it doesn't necessarily pertain to this question, I'd like to post it here so it exists somewhere. This documentation on the Android Developers site helped me.
To capture input directly (which is what we need to do to capture to OSK input), you need to override the OnKeyPress method on the activity your game is running in. For me, this looks as follows:
public class AndroidActivity : AndroidGameActivity
{
private void OnKeyPress(object sender, View.KeyEventArgs e)
{
// do stuff with the input
}
}
Hope this helps anyone else who got stuck with this; the information was hard to find, but now that I've changed my frame of mind to "how does Android/iOS handle this thing" I've been able to locate answers more easily. Good luck!

count any keystrokes whether or not Window (App) is in focus - WPF

I'm building a "WPF Application" which is made to be run in the background (minimised state) and detects KeyStrokes of each and Every key on the keyboard & every Mouse Clicks.
So, my question is how to detect every keyStrokes whether app (Window) is minimised or not.
Simply, if my app is in focus then i use this code to count keystrokes.
Public int count;
protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)
{
//base.OnKeyDown(e);
count++;
tBlockCount.Text = count.ToString();
}
I just want to do the same even if my app is minimised.
I've searched a lot and come across many suggestions like..
http://www.pinvoke.net/default.aspx/user32/registerhotkey.html
http://social.msdn.microsoft.com/Forums/vstudio/en-US/87d66b1c-330c-42fe-8a40-81f82012575c/background-hotkeys-wpf?forum=wpf
Detecting input keystroke during WPF processing
Detect if any key is pressed in C# (not A, B, but any)
Most of those are indicating towards Registering HotKeys. But I'm unable to match scenario with mine.
Any kind of suggestion are most welcome.
Although I'm not really condoning the use of a keylogger (This is what you are trying to do). I would recommend taking a look at this q/a, the section near the bottom of this article, and this article for some inspiration. These should help point in the right direction for the coding side.
What you essentially need to do is just set up an event to intercept any keys that come in from the computer, then you can gather the key and do whatever you like with it (in your case, record it)
Edit: In fact, reading the third article, it actually gives a full code snippet on how to implement and use it in WPF, so I recommend just reading that one.

To get the Form from its Processhandle

Is there any way to get the Form from its Processhandle ?
Some thing like this.
Form form = (Form)Form.FromHandle(_process.MainWindowHandle);
But this is not working.
According to this post, that only works for window handles owned by your process. You can't use Form.FromHandle to get a form from some other process.
See also: How to use Control.FromHandle?
It's possible to do this from within a process. Trying to grab a Form or Control from another process won't work.
Can you give us some more information as to what you're trying to do here with the Form? There may be a better way to accomplish it.

Using F1 Help (CHM format) With WPF

I've been working on a WPF application for a while, and the time has come to attach the CHM format help document to it.
But alas! HelpProvider, the standard way to show CHM files in Winforms, has magically vanished and has no counterpart in WPF. I've been trying to use WindowsFormsHost to spawn a new control so I can actually display the help, but essentially it just grabs control of the entire UI.
A little more detail: I've got a menu item that I want to, when clicked, open up the CHM file.
First I set up the WindowsFormsHost...
host = new System.Windows.Forms.Integration.WindowsFormsHost();
helpForm = new System.Windows.Forms.Control();
host.Child = helpForm;
host.Visibility = System.Windows.Visibility.Hidden;
this.grid1.Children.Add(host);
hp = new System.Windows.Forms.HelpProvider();
hp.HelpNamespace = "Somehelpfile.chm";
hp.SetHelpNavigator(helpForm, System.Windows.Forms.HelpNavigator.TableOfContents);
And then I say, voila, reveal yourself.
private void Help_Click(object sender, RoutedEventArgs e)
{
host.Visibility = Visibility.Visible;
helpForm.Show();
hp.SetShowHelp(helpForm, true);
}
I'm not really sure of where to proceed from here. When I show the helpForm, it obscures / overrides the existing UI and all I get is a gray, empty WPF window with no help file.
Any takers?
If you include System.Windows.Forms.dll you can also do:
System.Windows.Forms.Help.ShowHelp(null, #"help.chm");
Also, there's an article here about adding a context sensitive help system to WPF.
Call me crazy, but couldn't you just do:
System.Diagnostics.Process.Start(#"C:\path-to-chm-file.chm");
I am trying out Easy Help with WPF, which also addresses context sensitive help based on key words. So far it seems good. All I need to do is get cracking and write some decent help!
You can use http://www.pinvoke.net/default.aspx/hhctrl.HtmlHelp to open chm help at specified topic and to have more control of how chm window shown.
How about using the Help class instead of opening the file externally

Categories