From: Juergen Thuemmler on 1 Apr 2010 15:39 Hi Karl, > It'd help to have a better definition of "not processed correctly." <g> when I use 'Call MySendKeys("@&\3öäi~|²µ")' to Notepad, there will arrive "q&ß3öäi+<2m". For explanation: @ = Q-Key with Alt Gr (VCode = 81, ScanCode = 16), \ = ß-Key with Alt Gr (VCode = 219, ScanCode = 12), ~ = +-Key with Alt Gr (VCode = 187, ScanCode = 27), | = <-Key with Alt Gr (VCode = 226, ScanCode = 86), ² = 2-Key with Alt Gr (VCode = 50, ScanCode = 3), µ = M-Key with Alt Gr (VCode = 77, ScanCode = 50), Curiously, "{ENTER}" works correctly, although "{" and "}" are also created with Alt Gr... > What I'd urge (what I'd do if I could recreate) is for you to put a > breakpoint ProcessChar, and see what's happening there. That should > lend some insight into the problem. Are there unexpected branches > occurring there, that you don't see with other keyboard chars? I've modified you procedure as follows: Private Sub ProcessChar(this As String) Dim code As Integer, di As Integer Dim vk As Integer, sc As Integer Dim capped 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) DebugPrint this, di, vk, sc Call StuffBuffer(vk, capped) Else 'unicode Call StuffBufferW(code) End If End Sub The DebugPrint of above mentioned string gives @ 1617 81 6 & 310 54 1 \ 1755 219 6 3 51 51 0 ö 192 192 0 ä 222 222 0 i 73 73 0 ~ 1723 187 6 | 1762 226 6 ² 1586 50 6 µ 1613 77 6 All the "Alt Gr"-characters have a "sc=6". Does it help? Thanks, Juergen.
From: Karl E. Peterson on 1 Apr 2010 16:24 Juergen Thuemmler wrote: > Hi Karl, > >> It'd help to have a better definition of "not processed correctly." <g> > > when I use 'Call MySendKeys("@&\3��i~|��")' to Notepad, there will arrive > "q&�3��i+<2m". For explanation: > > @ = Q-Key with Alt Gr (VCode = 81, ScanCode = 16), > \ = �-Key with Alt Gr (VCode = 219, ScanCode = 12), > ~ = +-Key with Alt Gr (VCode = 187, ScanCode = 27), >> = <-Key with Alt Gr (VCode = 226, ScanCode = 86), > � = 2-Key with Alt Gr (VCode = 50, ScanCode = 3), > � = M-Key with Alt Gr (VCode = 77, ScanCode = 50), > > Curiously, "{ENTER}" works correctly, although "{" and "}" are also created > with Alt Gr... Yeah, because I'm doing the named keys processing myself. :-) >> What I'd urge (what I'd do if I could recreate) is for you to put a >> breakpoint ProcessChar, and see what's happening there. That should >> lend some insight into the problem. Are there unexpected branches >> occurring there, that you don't see with other keyboard chars? > > I've modified you procedure as follows: > > Private Sub ProcessChar(this As String) > Dim code As Integer, di As Integer > Dim vk As Integer, sc As Integer > Dim capped 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) > DebugPrint this, di, vk, sc > Call StuffBuffer(vk, capped) > Else 'unicode > Call StuffBufferW(code) > End If > End Sub > > The DebugPrint of above mentioned string gives > > @ 1617 81 6 > & 310 54 1 > \ 1755 219 6 > 3 51 51 0 > � 192 192 0 > � 222 222 0 > i 73 73 0 > ~ 1723 187 6 >> 1762 226 6 > � 1586 50 6 > � 1613 77 6 > > 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)? 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 2) a lookup table for Alt-Gr translations. 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. -- ..NET: It's About Trust! http://vfred.mvps.org
From: Karl E. Peterson on 1 Apr 2010 16:46 Karl E. Peterson wrote: > 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)? D'oh! Yes it's doc'd. That page says: "For keyboard layouts that use the right-hand ALT key as a shift 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." Of course, it doesn't seem to offer a way of distinguishing this masquarade. <sigh> -- ..NET: It's About Trust! http://vfred.mvps.org
From: Juergen Thuemmler on 1 Apr 2010 17:25 Hi Karl, >> 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)? No; as I posted in this thread, <-> you are right, it is a key, which generates (when pressed and released) Ctrl Down Alt Down (as extended key) Ctrl Up Alt Up (as extended key) </> The special feature together with "Alt Gr" is the "extended key" flag for "Alt", which normally has not such a flag... Juergen.
From: Helmut Meukel on 1 Apr 2010 18:02 "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. > 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? Helmut.
|
Next
|
Last
Pages: 1 2 3 4 5 6 Prev: Hovering over an ActiveX object Next: Twips, Pixels, and Font size |