The purpose is for an on screen keyboard, I would like to know if the user has focused (clicked on or tabbed into) a control that allows text input so the keyboard can optionally automatically popup. I assume there is a windows message that I hook that gives me hWind of active controls when focus changes, then perhaps there is another pinvoke that alows me to check for control type based on hWind?, unfortunately thats the extent of my knowledge on the subject.
Asked
Active
Viewed 54 times
0
-
What kind of on-screen keyboard? The official osk.exe built-in to Windows uses Windows Accessibility and automation events to detect when an input has focus and can accept keyboard entry, but it isn't always reliable as third-party controls often do their own thing. – Dai Mar 05 '17 at 00:28
-
This is for my own, not MS's OSK. – Wobbles Mar 05 '17 at 00:32
1 Answers
-1
You can get just the event when something got the focus with the GotFocus event: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.gotfocus.aspx
You can apply it to all Forms.

Larce
- 841
- 8
- 17
-
1
-
So it could be a duplicate of http://stackoverflow.com/questions/4407631/is-there-windows-system-event-on-active-window-changed ? – Larce Mar 05 '17 at 00:34
-
1
-
I think the description really fits your needs. The windows message you are looking for is [VM_ACTIVE](http://msdn.microsoft.com/en-us/library/ms646274%28v=vs.85%29.aspx) – Larce Mar 05 '17 at 00:40
-
1
-
When you only want to get your keyboard active when you focussed the text box (not the form) you can use the instructions here: http://stackoverflow.com/a/14393399/7658355 – Larce Mar 05 '17 at 00:46
-
Thats cpp and still doesn't contain a solution beyond what I already speculated in that setting a window hook would likely be needed. – Wobbles Mar 05 '17 at 00:51