473,779 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting char to keyboard-mapped code

Hi! Suppose I detected, using DInput, the 1 key is pressed. I wanna get the
shift+1 symbol on the current culture-keyboard....

For example.... In my spanish keyboard, shift+1 yields a "!". This is not
valid for ALL the keyboards in the world... so How can I get the [shift]+1
keyboard-mapped character?

thx in advance.
Nov 15 '05 #1
2 2953
Well, there is no built-in way to do this, is thats what you are asking. It
is some fancy usage via pinvoke of the ToUnicode() API (the MS Keyboard
Layout Creator has to do this when you load from an existing layout).
--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Santy" <jo****@mixmail .com> wrote in message
news:eH******** ******@TK2MSFTN GP11.phx.gbl...
Hi! Suppose I detected, using DInput, the 1 key is pressed. I wanna get the shift+1 symbol on the current culture-keyboard....

For example.... In my spanish keyboard, shift+1 yields a "!". This is not
valid for ALL the keyboards in the world... so How can I get the [shift]+1
keyboard-mapped character?

thx in advance.

Nov 15 '05 #2
Note, however, that doing this will ruin the keystroke buffer for things
like dead keys -- so it will actually hurt the ability to input data if you
go this route (a painful lesson learned while MSKLC was being developed!).

Realistically, you would have to

1) At the start of the app, obtain and store the information on every single
possible keystroke and dead key in the keyboard layout;

2) Listen for WM_INPUTLANGCHA NGE messages

3) Any time it changes, re-run step #1 with the new layout

4) Any time there is a keystroke, get the information on what you want.

By no means, a trivial exercise. But the above plan has the advantage of
working properly....

--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Michael (michka) Kaplan [MS]" <mi*****@online .microsoft.com> wrote in
message news:eZ******** ******@TK2MSFTN GP09.phx.gbl...
Well, there is no built-in way to do this, is thats what you are asking. It is some fancy usage via pinvoke of the ToUnicode() API (the MS Keyboard
Layout Creator has to do this when you load from an existing layout).
--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Santy" <jo****@mixmail .com> wrote in message
news:eH******** ******@TK2MSFTN GP11.phx.gbl...
Hi! Suppose I detected, using DInput, the 1 key is pressed. I wanna get

the
shift+1 symbol on the current culture-keyboard....

For example.... In my spanish keyboard, shift+1 yields a "!". This is not valid for ALL the keyboards in the world... so How can I get the [shift]+1 keyboard-mapped character?

thx in advance.


Nov 15 '05 #3

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

Similar topics

5
13928
by: matt melton | last post by:
Hi there, I am trying to write a method that accepts an array of any primitive type and will return the same array without copying memory as an array of bytes. ie. I'd like to be able to do something like: char chars = "Hello!"; byte bytes = (byte) chars;
22
5497
by: Keith MacDonald | last post by:
Hello, Is there a portable (at least for VC.Net and g++) method to convert text between wchar_t and char, using the standard library? I may have missed something obvious, but the section on codecvt, in Josuttis' "The Standard C++ Library", did not help, and I'm still awaiting delivery of Langer's "Standard C++ IOStreams and Locales". Thanks,
6
8711
by: Haas | last post by:
Hello folks, I just started a C++ course. An exercise is to give the ASCII value of a character read from keyboard. I place the input from the keyboard in a char-variable. How can i get the ASCII value of this char? Is there a built-in function? Or should i check the full table? Thanks. Jasper
20
2189
by: Nate | last post by:
I am working on an Oakley parser and want to call an fopen function to read in the log file. I can use this to read the file, but only if I pass a "const char" variable to fopen. Since I would like the end user to specify the name of the log file, I have a scanf in there to allow the user to do so, but it isn't a const at that point. I have seen reference to calls like static_cast, dynamic_cast and reinterpret_cast in C that will allow...
4
5401
by: Prabhu | last post by:
Hi, We are having problem in converting a byte array to string, The byte array has char(174), char(175), char(240), char(242) and char(247) as delimiters for the message. when we use "System.Text.Encoding.ASCII.GetString(bytearray)" of .Net library, we found that the char (delimiters) specified above are replaced with different char.
6
12558
by: Manish | last post by:
In my application there is need for only upper case chars.. Currently I am making entry to upper case when user leaves focus of the text control. I want to do some modification here...When user enters any char in small case...during that entry it should convert in upper case... It is very easy in VB6..In VB6 you just need to convert the Ascii value to char ---> then to Ucase ---> then char to Ascii again...this can be done in keypress...
9
30522
by: Gregory.A.Book | last post by:
I am interested in converting sets of 4 bytes to floats in C++. I have a library that reads image data and returns the data as an array of unsigned chars. The image data is stored as 4-byte floats. How can I convert the sets of 4 bytes to floats? Thanks, Greg Book
0
2033
by: anide | last post by:
Hi all I’ve some problem, I’m trying to converting a sorting algorithm from C++ to C#. In C++ I’ve compiled it using MSVC and its working properly, and in C# I’m using .NET Framework 2.0 (Visual Studio 2005). The problem occurred when I trying to opening and reading file: ============= C++ ============= void LoadSourceFile(char * fileName, unsigned char * data, int length)
11
12783
by: hamishd | last post by:
Is this possible? Sorry if this question isn't relevant here. actually, I'm really trying to convert a unsigned char * to an int
35
34562
by: Sean Farrow | last post by:
Hi: What is best and safest way of converting a char* to a const char *? Can I use const_cast? Cheers Sean.
0
9632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10302
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.