Login  
Search All Forums
Dart Home | PowerTCP Emulation for ActiveX | Custom Development Reply | PowerTCP Emulation / Telnet for ActiveX Topics | Forums   
AuthorForum: PowerTCP Emulation / Telnet for ActiveX
Topic: VT emulator Numeric Keypad and Windows 64 bit
MBSII.Net

From: USA
Posts: 4
Member Since: 05/10/11
posted January 6, 2014 3:32 PM

Hello,
I am having an issue with the VT Emulator in a VB6 program.
The numeric keypad numbers and (+-*/) do not work in Windows 64 bit O.S. With my old Power TCP control I had specific code to check for these keypad entry's and modify the output if one of the numeric keypads where hit. I can't get any case logic to work with the Key Variant Variable that returns when a user strikes a key on KeyPressEx. Any help would be greatly appreciated.
Thanks,
Tim
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted January 6, 2014 5:23 PM

Hello,

Can you clarify what you mean by that it 'doesn't work'? Is the event raised? Does 'Key' return a consistent value each time a numpad key is pressed?

What OS were you previously using, and what OS are you now working with?

What is the value of Vt.Keypad? vtNumeric should be used when using the numerical numpad.

I tested this on a Windows 7 x64 machine, and encountered no issues; the numpad keys all worked. The +, /, - and * keys do raise the event with a multi-byte encoded value, perhaps you're not handling that? I would recommend adding a watch for the value of 'Key', and hit the numpad keys to determine the expected values on your system.

Another option would be to use the KeyDown event instead of the KeyPressEx event, if you would prefer to deal with an integer KeyCode value instead.

------
-Non-current subscribers must contact sales@dart.com to update subscription and receive continued support as needed.
------

MBSII.Net

From: USA
Posts: 4
Member Since: 05/10/11
posted January 6, 2014 5:32 PM

Well it doesn't produce the actual value of the key pressed. Instead it displays an ^?Q for the / and like an ^?OP for when the plus sign is hit. The numbers and +-/* on the regular keypad work fine. It's only on the number keypad that we have an issue. And only for 64 bit PC's. I even tested with the free sample download Dart supplies with the control and it does the same thing. The result in "Key" varies based on which numeric keypad entry you hit. This occurs on all 64 bit Windows PC'. It is not a problem on 32 bit PC's. I will try what you suggested tomorrow. Is there any way to find out what's in "Key"? I tried to debug in VB but you cannot see the value. I can only see the values displayed on the screen. Are these the true values, or some kind of hex or ASCII codes?
MBSII.Net

From: USA
Posts: 4
Member Since: 05/10/11
posted January 7, 2014 11:11 AM

Hello
Here are examples of the values displayed when the following keys are entered:
KEY = Result Displayed
-----------------------
NUM lOCKS = ^?P
/ = ^?Q
* = ^?R
- = ^?S
+ = ,

This program project is huge and very old.. I've only had to modify to get to work with the new Emulator Control we bought from Dart. I'm not a VB6 expert but having a wide range background in coding can figure anything out. The old program with the old Power TCP control had the following "OnKeyDown" function (displayed below) that I believe I need AND need to modify for the new control cause it doesn't work with the new contol.. I believe it checks the value of Key entered, for the Keypad and function keys, and changes and sends the correct value to the screen. However I cannot get the new "KeyDown" function you mention to work.. any help modifying this code, or on the KeyDown function, would be greatly appreciated. Thanks:

Private Sub VT2201_OnKeyDown(nKeyCode As Integer, nShift As Integer, ByVal bExtended As Boolean)

Dim intFidx As Integer
Dim strCommand As String

  'MsgBox nKeyCode & " , " & nShift & "," & bExtended
  'mapping 111 = /
  '     144 = Num Lock
  '     106 = *
  '     109 = -
  '     107 = +   (all on numeric keypad)
  '     112 = F1
  '     113 = F2
  '     114 = F3
  '     115 = F4
  '     116 = F5
  Select Case nKeyCode
    Case 111      ' / - slash
      nKeyCode = 191
      nShift = 0
      bExtended = False
    Case 112 To 123  ' F1 - F12
      intFidx = nKeyCode - 111
      If nShift = 0 Then
        strCommand = garrFunk(intFidx)
      Else
        strCommand = garrShiftFunk(intFidx)
      End If
      If strCommand <> "" Then
        Call SendCommand(strCommand)
        nKeyCode = 0
      End If
    Case 144      ' Num Lock
      nKeyCode = 0
    Case 106      ' *
      nKeyCode = 0
      TELNET1.Send "*", False
    Case 109      ' -
      nKeyCode = 0
      TELNET1.Send "-", False
    Case 107      ' +
      nKeyCode = 0
      TELNET1.Send "+", False
'    Case 67
'     Debug.Print Mid(VT2201.GetText, VT2201.SelStart, VT2201.SelLength)
  End Select

  If gintKeyPadFlag = 0 Then  ' numeric keypad
    Select Case nKeyCode
      Case 96 To 105 ' 0 - 9 on numeric keypad
        TELNET1.Send CStr(nKeyCode - 96), False
        nKeyCode = 0
      Case 110    ' . (period)
        nKeyCode = 0
        TELNET1.Send ".", False
      Case 13     ' Enter key
        If bExtended = True Then
          nKeyCode = 0
          TELNET1.Send gstrCR, False
        End If
    End Select
  End If
  TELNET1.Send Key
End Sub

Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted January 7, 2014 12:16 PM

Hello,

The KeyPressEx event is raised with the value that would be sent to the server; /, * and - equate to function keys on a VT keyboard. See PF1-PF4 here:
http://ascii-table.com/ansi-escape-sequences-vt-100.php

See the VT Keyboard layout here:
http://www.vt100.net/docs/vt100-ug/chapter1.html#S1.1

I am unable to reproduce any difference between x64 and x86 machines with the Numpad and our control. I tested on Windows 7 x64 and Windows XP x86. Perhaps you're using different code, or different events on your two machines?

Your provided code seems to rely upon the KeyCode value, not the value presented by the KeyPressEx event, so I would recommend using the KeyDown event, which does provide the KeyCode of the pressed key. Further assistance will require a support contract, please contact sales@dart.com for details.
MBSII.Net

From: USA
Posts: 4
Member Since: 05/10/11
posted January 7, 2014 12:48 PM

Thank you sir. You led me in the right direction and I was able to make the KeyDown function to work very easily using the existing (older) function with some miniscule changes:

Private Sub VT2201_KeyDown(KeyCode As Integer, Shift As DartVtCtl.ShiftConstants, ByVal Extended As Boolean)
  ' OLD - prior to 01/2014 - Private Sub VT2201_OnKeyDown(nKeyCode As Integer, nShift As Integer, ByVal bExtended As Boolean)
  
  Dim intFidx As Integer
  Dim strCommand As String

  'MsgBox nKeyCode & " , " & nShift & "," & bExtended
  'mapping 111 = /
  '     144 = Num Lock
  '     106 = *
  '     109 = -
  '     107 = +   (all on numeric keypad)
  '     112 = F1
  '     113 = F2
  '     114 = F3
  '     115 = F4
  '     116 = F5
  Select Case KeyCode
    Case 111      ' / - slash
      KeyCode = 191
      Shift = 0
      Extended = False
    Case 112 To 123  ' F1 - F12
      intFidx = KeyCode - 111
      If Shift = 0 Then
        strCommand = garrFunk(intFidx)
      Else
        strCommand = garrShiftFunk(intFidx)
      End If
      If strCommand <> "" Then
        Call SendCommand(strCommand)
        KeyCode = 0
      End If
    Case 144      ' Num Lock
      KeyCode = 0
    Case 106      ' *
      KeyCode = 0
      TELNET1.Send "*", False
    Case 109      ' -
      KeyCode = 0
      TELNET1.Send "-", False
    Case 107      ' +
      KeyCode = 0
      TELNET1.Send "+", False
'    Case 67
'     Debug.Print Mid(VT2201.GetText, VT2201.SelStart, VT2201.SelLength)
  End Select

  If gintKeyPadFlag = 0 Then  ' numeric keypad
    Select Case KeyCode
      Case 96 To 105 ' 0 - 9 on numeric keypad
        TELNET1.Send CStr(KeyCode - 96), False
        KeyCode = 0
      Case 110    ' . (period)
        KeyCode = 0
        TELNET1.Send ".", False
      Case 13     ' Enter key
        If Extended = True Then
          KeyCode = 0
          TELNET1.Send gstrCR, False
        End If
    End Select
  End If
End Sub
Reply | PowerTCP Emulation / Telnet for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX