How to detect fullstop in message pump?

Started by
5 comments, last by Andrew Russell 18 years, 10 months ago
Hi, I am using C++. How do I detect whether the fullstop key has been pushed, eg '.' ? To detect that I push escape I go: if(wParam==VK_ESCAPE) but how do I detect when I push fullstop?

HTML5, iOS and Android Game Development using Corona SDK and moai SDK

Advertisement
The full-stop key on a normal US keyboard layout maps to the number 190 (I have no idea what VK_ that is).

if(wParam==190) { DoStuff(); }
isn't it VK_PERIOD?

- Jason Astle-Adams

Ok, I can detect a full stop, but it gets mixed up with backspace and delete key. So I push fullstop and it deletes.

HTML5, iOS and Android Game Development using Corona SDK and moai SDK

What exactly does it delete? What code is doing the deletion (or is not supposed to be doing the deletion)?
I was detecting for the backspace and the delete key.

It wasn't picking up 190 as fullstop.

Instead 46 is fullstop, so 46 works.

Thanks.

HTML5, iOS and Android Game Development using Corona SDK and moai SDK

46 is the ASCII value for '.' (you get that from WM_CHAR).

190, VK_PERIOD is the code you will get from WM_KEYDOWN. I assumed this is what you were doing - as this is what you use VK_ESCAPE for. You shouldn't use VK_ codes with WM_CHAR.

An extra tip - instead of using the number 46, put the '.' in single quotation marks.

This topic is closed to new replies.

Advertisement