From: Karl E. Peterson on
Helmut Meukel wrote:
> "Karl E. Peterson" <karl(a)exmvps.org> schrieb im Newsbeitrag
> news:OouGRld0KHA.3676(a)TK2MSFTNGP05.phx.gbl...
>> Juergen Thuemmler wrote:
>>>
>>> All the "Alt Gr"-characters have a "sc=6". Does it help?
>>
>> Yeah, that's a helluva clue. Undoc'd at first lookup, too...
>>
>> http://msdn.microsoft.com/en-us/library/ms646329%28VS.85%29.aspx
>>
>> I read that to say that sc=6 would be a combined CTRL-ALT. Does that ring
>> any bells (for any Alt-Gr users)?
>>
>
> Early european keyboards had no Alt Gr key just two Alt keys and you had
> always to press Ctrl-Alt to get those characters. I tested it, it still
> works.
> So the new Alt Gr key only creates a Ctrl-Alt sequence to make life easier
> for us Europeans.

Interesting!

>> I can see this routine needs further tweaking. But, in order to do that,
>> we need two things.
>>
>> 1) a way to distinguish whether sc=6 really meant Alt-Gr or CTRL-ALT, and
>
> see above.
>
> BTW, what does an US-keyboard generate if you press Ctrl-Alt-m or
> Ctrl-Alt-e ? My german keyboard generates � and �.
> And how do you generate the degree sign (as in 8 �C) or th legalese
> section-mark � ? They are missing on an US-keyboard, right?

Right. And, unfortunately, you don't. Unless you know the character
code. I can create "�" (the degree symbol) by doing Alt-0176 on the
numeric keypad. We lead extremely sheltered lives in this country!

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Helmut Meukel on
"Karl E. Peterson" <karl(a)exmvps.org> schrieb im Newsbeitrag
news:OjW1die0KHA.264(a)TK2MSFTNGP05.phx.gbl...
> Helmut Meukel wrote:
>> "Karl E. Peterson" <karl(a)exmvps.org> schrieb im Newsbeitrag
>> news:OouGRld0KHA.3676(a)TK2MSFTNGP05.phx.gbl...
>>> Juergen Thuemmler wrote:
>>>>
>>>> All the "Alt Gr"-characters have a "sc=6". Does it help?
>>>
>>> Yeah, that's a helluva clue. Undoc'd at first lookup, too...
>>>
>>> http://msdn.microsoft.com/en-us/library/ms646329%28VS.85%29.aspx
>>>
>>> I read that to say that sc=6 would be a combined CTRL-ALT. Does that ring
>>> any bells (for any Alt-Gr users)?
>>>
>>
>> Early european keyboards had no Alt Gr key just two Alt keys and you had
>> always to press Ctrl-Alt to get those characters. I tested it, it still
>> works.
>> So the new Alt Gr key only creates a Ctrl-Alt sequence to make life easier
>> for us Europeans.
>
> Interesting!
>
>>> I can see this routine needs further tweaking. But, in order to do that, we
>>> need two things.
>>>
>>> 1) a way to distinguish whether sc=6 really meant Alt-Gr or CTRL-ALT, and
>>
>> see above.
>>
>> BTW, what does an US-keyboard generate if you press Ctrl-Alt-m or
>> Ctrl-Alt-e ? My german keyboard generates � and �.
>> And how do you generate the degree sign (as in 8 �C) or th legalese
>> section-mark � ? They are missing on an US-keyboard, right?
>
> Right. And, unfortunately, you don't. Unless you know the character code. I
> can create "�" (the degree symbol) by doing Alt-0176 on the numeric keypad.
> We lead extremely sheltered lives in this country!
>
> --


Karl,

I faintly remember my disappointment with the - then - new keyboards
with the Alt Gr key instead of the right Alt key. I was used to pressing
Ctrl-Alt with my left hand and the associated key with my right index
finger to get the { [ \ | ] } symbols. So I continued to use Ctrl-Alt
instead of Alt Gr. After an OS update or service pack this no longer
worked and I had to use Alt Gr. I tested it now with Win2000 and
WinNT4.0 SP6a and Ctrl-Alt worked on both. So M$ had reversed
it later on or I remember things that never have been.
I had never used Win95/98/ME, I went from WfW3.11 straight to
NT3.51 and then to NT4.0.

BTW, the guys at M$ who programmed Word (I checked it with
Word 97 and Word2000) extended this Ctrl-Alt/Alt Gr functionality
for more symbols:
Crtl-Alt-. generates . (same as Alt0133)
Crtl-Alt-t generates T (same as Alt0153)
Crtl-Alt-r generates � (same as Alt0174)
Crtl-Alt-c generates � (same as Alt0169)
at least with a german Word on a german Window and german
keyboard.
Is this the same with the US versions?

Helmut.

From: Helmut Meukel on
Grrr,

my answer got screwed up somewhere on the way to the news server and back to me.

"Helmut Meukel" <NoSpam(a)NoProvider.de> schrieb im Newsbeitrag
news:el$jQQl0KHA.4420(a)TK2MSFTNGP02.phx.gbl...
>
> BTW, the guys at M$ who programmed Word (I checked it with
> Word 97 and Word2000) extended this Ctrl-Alt/Alt Gr functionality
> for more symbols:
> Crtl-Alt-. generates . (same as Alt0133)

This should be the ellipsis ...

> Crtl-Alt-t generates T (same as Alt0153)

and this the trademark symbol TM

> Crtl-Alt-r generates � (same as Alt0174)
> Crtl-Alt-c generates � (same as Alt0169)
> at least with a german Word on a german Window and german
> keyboard.
> Is this the same with the US versions?
>
> Helmut.

Helmut.

From: Juergen Thuemmler on
Hi Karl,

> 2) a lookup table for Alt-Gr translations.

here it is (german keyboard):
"@", VK=81
"|", VK=226
"\", VK=219
"�", VK=77
"�", VK=69
"�", VK=50
"{", VK=55
"}", VK=48
"[", VK=56
"]", VK=57
"~", VK=187

Juergen.


From: Juergen Thuemmler on
Hi Karl,

> I'm at a bit of a loss how the first might be determined. And I'm not
> even sure if the second is the best way to approach it. What we really
> need is someone who is very familiar with those alternate keyboard
> layouts - specifically, how they're translated for the OS - to help out
> here.

I've modified your code as shown below. Now it works as expected. Could you
check, whether it still works under your conditions?

Thanks, Juergen.

Private Sub ProcessChar(this As String)
Dim code As Integer, di As Integer
Dim vk As Integer, sc As Integer
Dim capped As Boolean, AltGr As Boolean '<<<###

code = AscW(this)
If code >= 0 And code < 256 Then 'ascii
di = VkKeyScan(Asc(this))
capped = CBool(ByteHi(di) And 1)
vk = ByteLo(di)
sc = ByteHi(di): If sc = 6 Then AltGr = True
Call StuffBuffer(vk, capped, , AltGr)
Else 'unicode
Call StuffBufferW(code)
End If
End Sub

Private Sub StuffBuffer(ByVal vk As Integer, Optional Shifted As Boolean, _
Optional Extended As Boolean, Optional AltGr As
Boolean)
' Only mess with Shift key if not already pressed.
If CBool(m_ShiftFlags And vbShiftMask) = False Then
If Shifted Then
With m_Events(m_EvtPtr)
.wVK = vbKeyShift
End With
m_EvtPtr = m_EvtPtr + 1
End If
End If

'# Special handling for signs created with "Alt Gr"
If AltGr Then
With m_Events(m_EvtPtr)
.wVK = vbKeyCtrl ' =17, missing in vbKey... constants
End With
m_EvtPtr = m_EvtPtr + 1
With m_Events(m_EvtPtr)
.wVK = vbKeyMenu
End With
m_EvtPtr = m_EvtPtr + 1
End If

' Press and release this key.
With m_Events(m_EvtPtr)
.wVK = vk
If Extended Then
.dwFlags = KEYEVENTF_EXTENDEDKEY
End If
End With
m_EvtPtr = m_EvtPtr + 1

With m_Events(m_EvtPtr)
.wVK = vk
.dwFlags = .dwFlags Or KEYEVENTF_KEYUP
End With
m_EvtPtr = m_EvtPtr + 1

'# Special handling for signs created with "Alt Gr"
If AltGr Then
With m_Events(m_EvtPtr)
.wVK = vbKeyMenu
.dwFlags = KEYEVENTF_KEYUP
End With
m_EvtPtr = m_EvtPtr + 1
With m_Events(m_EvtPtr)
.wVK = vbKeyCtrl
.dwFlags = KEYEVENTF_KEYUP
End With
m_EvtPtr = m_EvtPtr + 1
End If

' Only mess with Shift key if not already pressed.
If CBool(m_ShiftFlags And vbShiftMask) = False Then
If Shifted Then
With m_Events(m_EvtPtr)
.wVK = vbKeyShift
.dwFlags = KEYEVENTF_KEYUP
End With
m_EvtPtr = m_EvtPtr + 1
End If
End If
End Sub