[fpc-pascal] keyboard layout.
Marco van de Voort
marcov at stack.nl
Sun Nov 21 11:56:07 CET 2004
> We are having a problem with keyboard layouts in the keyboard unit in windows.
> Currently it is automatically assumed that both alt keys differ.
> So this is a small poll:
> What is your Windows keyboardlayout, and are your two alt keys different (ALT-GR system)?
> Layout: ALT-GR ?
> US no
Florian dug up some C++ code that I tried to convert. Could sb try to run this on his windows
machine, and check if the ALT-GR status is detected correctly.
Please also mention your windows version, since I found notes here and there that some aspects
of keyboardlayouts are NT specific.
// Checks if the right-hand ALT key is used as a 2nd shift key
var hklold : HKL = 0;
var HasAltGr : Boolean = false;
var ahkl : HKL;
i : integer;
if (hklOld<>ahkl) then
while i<$100 do
// For keyboard layouts that use the right-hand ALT key as ashift key
// (for example, the French keyboard layout), the shift state is
// represented by the value 6, because the right-hand ALT key is
// converted internally into CTRL+ALT.
if (HIBYTE(VkKeyScanEx(chr(i),ahkl))=6) then
if HasAltGr then writeln(' Has altgr') else writeln('shouldn''t have alt-gr');
More information about the fpc-pascal