C++ Learning Community Forum
August 01, 2010, 03:26:35 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Hello. Smiley
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Using WM_CHAR  (Read 562 times)
clcuseruk
N00b!!1
*
Posts: 1


View Profile
« on: February 23, 2010, 03:46:39 PM »

I am a novice at C++ Win App writing.

I am using Visual Studio 2008 Express Edition with Windows XP MCE.

I am writing a basic app which simply deals with receiving input via keyboard and mouse and outputs responses by messagebox, TextOut messages or dialogs.

I am using a switch case structure where case WM_CHAR is one of the options. Unfortunately, I don't know enough about WM_CHAR to write the necessary code.

Ideally, I would like to assign the character of the key pressed to a variable and be able to output a simple sentence like "You have pressed the A Key" using that variable. At the moment I am not sure what type of value WM_CHAR receives and therefore I don't know the the type of variable I need to set up.

I have looked on the interenet and searched various forums for suitable code but have not really found anything I can use.
 
Any information or help would br greatly appreciated please.TIA.
 
Logged
FrozenKnight
ASM Freak
Global Moderator
Dr. of C++ology
*****
Posts: 546


Do it yourself it's the only way to learn.


View Profile
« Reply #1 on: March 02, 2010, 10:26:37 AM »

First i would have you take a look at the msdn page for the WM_CHAR notification. (click on the WM_CHAR link in the previous sentence for a direct link to the msdn page)

To use this just typecast the wParam return to a char or wchar and add it to your string like you normally would. If you need help then consult the msdn page again or ask with a more specific question here.
Logged


Imagine the impossible, then make it happen.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!