4 Replies - 4818 Views - Last Post: 07 December 2014 - 08:29 PM Rate Topic: -----

#1 little_prince41   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 163
  • Joined: 10-August 07

How to catch barcode value from barcode scanner?

Posted 11 November 2014 - 09:47 PM

Hello!
I need to get barcode value from barcode scanner in textbox (all text) of another application before it sent enter key.
Now, I can get text value from textbox of another application as this post link but when barcode scanner send to textbox then it sent enter key I can't get any text.
The textbox have split ";" function as blow picture.

Example.
Posted Image

This post has been edited by little_prince41: 11 November 2014 - 10:01 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How to catch barcode value from barcode scanner?

#2 little_prince41   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 163
  • Joined: 10-August 07

Re: How to catch barcode value from barcode scanner?

Posted 16 November 2014 - 07:52 AM

i found a way for solve this problem.
1.Keyboard Hook
2.Rawinput
now i can get scanner code but i need to convert key value to keyboard string
somebody can help me?
Thanks.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14174
  • View blog
  • Posts: 56,776
  • Joined: 12-June 08

Re: How to catch barcode value from barcode scanner?

Posted 16 November 2014 - 03:19 PM

Question - does this app specifically allow you to snag data out of it? You are flirting with some questionable actions.
Was This Post Helpful? 0
  • +
  • -

#4 little_prince41   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 163
  • Joined: 10-August 07

Re: How to catch barcode value from barcode scanner?

Posted 16 November 2014 - 05:57 PM

Now, When i scan barcode my app get text as"ShiftKeyAShiftKeyVShiftKeySShiftKeySD2OemPeriodD0ShiftKeyFShiftKeyLOemQuestionShiftKeyBOem1D1D2D1D1D0D5D1D8D5D9D5D5OemMinusD0D0D1ShiftKeyXD2D0D1D2OemMinusD0D1D3D1SpaceSpaceSpaceSpaceSpaceSpaceShiftKeyWShiftKeyLD0D0D0D4D0D0ShiftKeyEShiftKeyED6Oem1Return" i need to convert to normal text.

This post has been edited by little_prince41: 16 November 2014 - 05:57 PM

Was This Post Helpful? 0
  • +
  • -

#5 little_prince41   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 163
  • Joined: 10-August 07

Re: How to catch barcode value from barcode scanner?

Posted 07 December 2014 - 08:29 PM

ฺNow, I can get barcode value 1D and 2D,it's work but 1D barcode has more length from real value.
Can you help me, please
 Private Sub RawInputKeyPressed(ByVal sender As Object, ByVal e As RawInput.InputDevice.KeyControlEventArgs)

        If e.Keyboard.deviceName = Me.Scanner_refer_txt.Text Then
            Const MAPVK_VK_TO_VSC = 0
            Dim keyblayoutID As Integer = GetKeyboardLayout(1)
            Dim ScanCode As Integer = MapVirtualKeyEx(e.Keyboard.key, MAPVK_VK_TO_VSC, keyblayoutID)
            Dim keystate(255) As Byte
            Dim buff As String = New String(ControlChars.NullChar, 256)
            Dim bufflen As Integer = buff.Length
            Dim ret As Integer = ToUnicodeEx(e.Keyboard.key, ScanCode, keystate, buff, bufflen, 0, keyblayoutID)
            Select Case ret
                Case -1 ' diactric
                Case 0 ' no translation
                Case Else ' How many characters are written into buffer
                    buff = buff.Substring(0, ret)
                    Me.Scanner_txt.Text = Me.Scanner_txt.Text + buff.ToUpper

                    If e.Keyboard.vKey = "Return" Then

                        Dim Barcode As String = Me.Scanner_txt.Text
                        Dim Split_Barcode As String() = Barcode.Split(";")

                        If Visible_WireLot = True Then
                            WireCode_txt.Text = Me.Scanner_txt.Text
                            Visible_WireLot = False
                        End If
                        If Visible_TermianlL = True Then

                            If Split_Barcode(0) = TerminalL_Name Then
                                TerminalL_txt.Text = Me.Scanner_txt.Text
                                Visible_TermianlL = False
                            End If

                        End If
                     Me.Scanner_txt.Text = ""
                    End If
            End Select
        End If
        Me.Scanner_name_txt.Text = e.Keyboard.deviceName

    End Sub

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1