From: Helmut Meukel on
"Juergen Thuemmler" <thue(a)removethisgmx.de> schrieb im Newsbeitrag
news:%23vNizdl0KHA.4168(a)TK2MSFTNGP02.phx.gbl...
> 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.

Juergen.

are you sure about those values?
To me it looks like a typo for "}".
Shouldn't it be 58?
The keys are in one row:
Alt Gr-7 => { (VK=55)
Alt Gr-8 => [ (VK=56)
Alt Gr-9 => ] (VK=57)
Alt Gr-0 => } (VK=48 ? )

what symbol is this "�", VK=69 ?
I assume it's the Euro symbol, right?

One other you left out: Alt Gr-3 => "�" (same as Alt0179)
I suspect it's VK=51, because you found Alt Gr-2 => "�", VK=50

Helmut.


From: Juergen Thuemmler on
Hi Helmut,

> are you sure about those values?
> To me it looks like a typo for "}".
> Shouldn't it be 58?

No, its 48.

> what symbol is this "�", VK=69 ?
> I assume it's the Euro symbol, right?

Right.

> One other you left out: Alt Gr-3 => "�" (same as Alt0179)
> I suspect it's VK=51, because you found Alt Gr-2 => "�", VK=50

Also right. But it does no matter, because the modified code doesn't need
these informations...

Juergen.


From: Karl E. Peterson on
Helmut Meukel wrote:
>>> 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!
>
> 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.

When you ran those tests in the older OS's, what keyboard did they
think they were using? I wonder if you were to tell them to use US
English, if those shortcuts would disappear?

> 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?

(Corrections noted.)

Wow!!! I never knew that. Just tried it in both Word 2003 and 2007,
and those all work just fine there! Flop over to any ordinary text
window (eg, Immediate window in VB IDE, or Notepad) and nothing
happens. I'll be damned...

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


From: Karl E. Peterson on
Juergen Thuemmler wrote:
> 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?

Yes, I'd be happy to! However, I just now realized that you weren't
working with the most recent version of the code. We should probably
start from that basepoint, eh? (I hope this couldn't have been solved
originally by having grabbed the more recent bits.)

That said, how you chose to handle it looks very robust. I'll try to
work that in, from this angle, as well.

Thanks... Karl



> 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

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


From: Juergen Thuemmler on
Hi Karl,

> Yes, I'd be happy to! However, I just now realized that you weren't
> working with the most recent version of the code. We should probably
> start from that basepoint, eh? (I hope this couldn't have been solved
> originally by having grabbed the more recent bits.)

well, I downloaded the latest available version (Dec 2009), modified it as
shown, and - it still works ;-)

Thanks, Juergen.