473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Virtual keyboard

Hi I'm trying to make a virtual keyboard and having problems with the
focusing and seeing to that the keyboard is always on top.

If I don't care about the keyboard being on top and use the following
method when I press a virtual key, just before generating the
keyevent, the focus will (at least some times) be set to the right
window and everything's fine. The window that had focus before I
pressed the keyboard gets the keystroke.

hwnd is the handle to the keyboard

void resetFocusToLastOwner(HWND hwnd){
HWND hwndNext = GetNextWindow(hwnd, GW_HWNDNEXT);
HWND hwndAnce = GetAncestor(hwndNext,GA_ROOTOWNER);
SetForegroundWindow(hwndAnce);
}

Well if I first set the keyboard to be always on top with the
following method

void SetToBeOnTop(HWND hwnd){
SetWindowPos(hwnd, HWND_TOPMOST, 0 ,0 ,0 ,0, SWP_NOACTIVATE |
SWP_NOSIZE);
}

then I cant find the right handle to the window that had focus before
I pressed the keyboard any more, I'm new to windows API, and if anyone
knows how to do this please tell me or point me in the right direction

Regards Linus.
Nov 14 '05 #1
1 3502
Linus Sylv?n wrote:
Hi I'm trying to make a virtual keyboard and having problems with the
focusing and seeing to that the keyboard is always on top.

If I don't care about the keyboard being on top and use the following
method when I press a virtual key, just before generating the
keyevent, the focus will (at least some times) be set to the right
window and everything's fine. The window that had focus before I
pressed the keyboard gets the keystroke.

hwnd is the handle to the keyboard

void resetFocusToLastOwner(HWND hwnd){
HWND hwndNext = GetNextWindow(hwnd, GW_HWNDNEXT);
HWND hwndAnce = GetAncestor(hwndNext,GA_ROOTOWNER);
SetForegroundWindow(hwndAnce);
}

Well if I first set the keyboard to be always on top with the
following method

void SetToBeOnTop(HWND hwnd){
SetWindowPos(hwnd, HWND_TOPMOST, 0 ,0 ,0 ,0, SWP_NOACTIVATE |
SWP_NOSIZE);
}

then I cant find the right handle to the window that had focus before
I pressed the keyboard any more, I'm new to windows API, and if anyone
knows how to do this please tell me or point me in the right direction

Regards Linus.


Try one of the MS newsgroups over on news.microsoft.com. You're very
off topic here.
Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kim Petersen | last post by:
Is it possible in Tkinter to simulate a keystroke into the current active (focused widget) by pressing another button (this is for a virtual keyboard on a touchscreen pc). the troubles i see is:...
11
by: Achintya | last post by:
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& #include<iostream> using namespace std; class A { int i; virtual void f(){ cout<<endl<<"i= "<<i; } public: A(int j) { i =...
2
by: Steven Malcolm | last post by:
Hi I am trying to build an application at work which will use a virtual keyboard on a touch screen. I have searched the archives and found references but nothing to download. If anyone has...
0
by: kurotsuke | last post by:
I need to convert a sequence of keys presses on the keyboard into the corresponding character code (UNICODE). I'm intercepting the KeyUp event (using an external hooking library) and need to get...
15
by: Jim Hubbard | last post by:
Is it possible to emulate a monitor (create a virtual monitor) using vb.net? Any code snippets or pointers to helpful articles would be very much appreciated.
8
by: sconeek | last post by:
hi all, i have a html form with multiple text fields, accepting input from a virtual onscreen keyboard. so far i have document.forms.elements.value+=x; The problem is that i dont want to...
6
by: noel.hunt | last post by:
I have a base class, PadRcv, with virtual functions. User code will derive from this class and possibly supply it's own functions to override the base class virtual functions. How can I test that...
1
by: lolly | last post by:
hi i recently used a virtual keyboard from www.codeproject.com/jscript/jvk.asp. However this part of the code function keyb_callback(ch) { var text =...
7
by: Christopher Pisz | last post by:
My problem is my derived class is getting called twice instead of the base and then the derived. I thought this was the purpose for virtuals and dynamic casting :/ I want my base class to have its...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.