Page 1 of 1

Posted: Tue Sep 03, 2002 11:30 am
by BackupUser
Restored from previous forum. Originally posted by GIDO.

is it possible when using keyboardpushed to get back somewhere
the table of ASCII code of the current layout keyboard ( not the ASCII key name, but the real value of the key normal, with shift, Alt)

Thank you .

Posted: Tue Sep 03, 2002 10:38 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> is it possible when using keyboardpushed to get back somewhere
> the table of ASCII code of the current layout keyboard ( not the
> ASCII key name, but the real value of the key normal, with shift,
> Alt)

I'm not sure what you mean, so check out both these tips and see if
they can help you somehow:

(1) viewtopic.php?t=1590
(2) viewtopic.php?t=1602


PB - Registered PureBasic Coder

Posted: Wed Sep 04, 2002 7:35 am
by BackupUser
Restored from previous forum. Originally posted by GIDO.
Originally posted by PB

> is it possible when using keyboardpushed to get back somewhere
> the table of ASCII code of the current layout keyboard ( not the
> ASCII key name, but the real value of the key normal, with shift,
> Alt)

I'm not sure what you mean, so check out both these tips and see if
they can help you somehow:

(1) viewtopic.php?t=1590
(2) viewtopic.php?t=1602


PB - Registered PureBasic Coder
Thank you for your answer ;
my problem is when using different keyboard layout :
if keyboardpushed(2)
for French : I want to have the ASCII code 38 for &
for english : I want to have the ASCII code 49 for 1
What can be the procedure for this ?

Thank you

Posted: Wed Sep 04, 2002 8:21 am
by BackupUser
Restored from previous forum. Originally posted by chr1sb.

The Win32 API function GetKeyboardLayout might be what you need (assuming you are using Windows)

See the following article:

http://www.gamedev.net/reference/articl ... cle842.asp


chr1sb

Posted: Wed Sep 04, 2002 10:31 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> my problem is when using different keyboard layout :
> if keyboardpushed(2)
> for French : I want to have the ASCII code 38 for &
> for english : I want to have the ASCII code 49 for 1

Sorry, but I still don't understand what you mean. You are showing
KeyboardPushed(2) up there... can I ask why? As far as I know, you
should be using PureBasic constants like #PB_Key_2...


PB - Registered PureBasic Coder

Posted: Thu Sep 05, 2002 12:39 pm
by BackupUser
Restored from previous forum. Originally posted by GIDO.

Thank you Chrisb and PB ;
So now , I can read the real ASCII code of my keyboard characters,
but only the minuscules ; I have now to find how I can have the ASCII code with shift and Alt ; I can't obtain results with getkeyboardstate
and the parameter scancode in function ToAsciiEx ?

my little test program
InitKeyboard()
adr=AllocateMemory(0,512,0)
adr1=AllocateMemory(1,512,0)
Repeat

; virk will be the virtual code of the pushed key
For i=0 To 255
k1=getasynckeystate_(i)
If k10:virk=i:EndIf
Next i

KS=GetKeyboardState_(adr) ; table status of the keys
layout=getKeyboardLayout_(0) ; current keyboard
Re=ToAsciiEx_(virk,scancode,adr,adr1,0,layout)
Asciicode=PeekW(adr1); ASCII code of the keyboard character

ExamineKeyboard()
re=KeyboardPushed(#PB_KEY_ESCAPE ); or (1)
Until re0
End

with my French keyboard, if key 2 is pushed (#PB_Key_1), I have
the good ASCII value 38 for & ; now I try to have 49 for 1 using
the shift .

Thank you for your help