Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. USB Card Reader

USB Card Reader

Scheduled Pinned Locked Moved C#
questioncsharphelp
13 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B bonkers123

    Hi, How does one go about, catching the events of a USB card reader... Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers). How do I go about obtaining the data event, where the data is written? How can I obtain the data written via a simple C# application. Does anyone understand my question. If vague, plz ask. Any help or starting point (documentation) would be much appreciated. Kinds regards, Higs

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Look here[^]. Enjoy :)

    I are troll :)

    D 1 Reply Last reply
    0
    • B bonkers123

      Hi, How does one go about, catching the events of a USB card reader... Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers). How do I go about obtaining the data event, where the data is written? How can I obtain the data written via a simple C# application. Does anyone understand my question. If vague, plz ask. Any help or starting point (documentation) would be much appreciated. Kinds regards, Higs

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #3

      Most card readers / scanners operate as a keyboard simply typing the read information onto the control / window that has focus. Check the API of your card reader, surely the vendor released some information.

      Check out the CodeProject forum Guidelines[^]

      B 1 Reply Last reply
      0
      • L Lost User

        Look here[^]. Enjoy :)

        I are troll :)

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #4

        What the hell are you smoking?? FileSystemWatcher to deal with a keyboard-based card reader??

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        L 1 Reply Last reply
        0
        • B bonkers123

          Hi, How does one go about, catching the events of a USB card reader... Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers). How do I go about obtaining the data event, where the data is written? How can I obtain the data written via a simple C# application. Does anyone understand my question. If vague, plz ask. Any help or starting point (documentation) would be much appreciated. Kinds regards, Higs

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #5

          If you're seeing the data in Notepad, this mean the card reader is acting like a keyboard. It'll type whatever the card contents are into whatever control has the focus.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          1 Reply Last reply
          0
          • D Dave Kreskowiak

            What the hell are you smoking?? FileSystemWatcher to deal with a keyboard-based card reader??

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers).

            He can access the data as if it were a file. I didn't see a reference to the keyboard-based interface :)

            Dave Kreskowiak wrote:

            What the hell are you smoking??

            Usually, or just right now? :suss:

            I are troll :)

            D 1 Reply Last reply
            0
            • B bonkers123

              Hi, How does one go about, catching the events of a USB card reader... Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers). How do I go about obtaining the data event, where the data is written? How can I obtain the data written via a simple C# application. Does anyone understand my question. If vague, plz ask. Any help or starting point (documentation) would be much appreciated. Kinds regards, Higs

              N Offline
              N Offline
              Neophyte30
              wrote on last edited by
              #7

              It sounds as though you are trying to do the same thing[^] I am. Using the generic HID reader from this page[^], and feeding it the vendor id and product id (which can be found in device manger), I get "The device is a system keyboard. Windows 2000 and Windows XP obtain exclusive access to Input and Output reports for this[sic] devices. Applications can access Feature reports only." Which, frankly, is a bit of a blow. Maybe there is another possible approach?

              L 1 Reply Last reply
              0
              • N Neophyte30

                It sounds as though you are trying to do the same thing[^] I am. Using the generic HID reader from this page[^], and feeding it the vendor id and product id (which can be found in device manger), I get "The device is a system keyboard. Windows 2000 and Windows XP obtain exclusive access to Input and Output reports for this[sic] devices. Applications can access Feature reports only." Which, frankly, is a bit of a blow. Maybe there is another possible approach?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                Since you can use DirectX to highjack a normal keyboard, maybe it works here as well?

                B 1 Reply Last reply
                0
                • L Lost User

                  Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers).

                  He can access the data as if it were a file. I didn't see a reference to the keyboard-based interface :)

                  Dave Kreskowiak wrote:

                  What the hell are you smoking??

                  Usually, or just right now? :suss:

                  I are troll :)

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #9

                  Eddy Vluggen wrote:

                  Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers). He can access the data as if it were a file.

                  Really? What file?? These things don't write to files. Neither do barcode scanners, laser scanners, or anything else. Since these devices do not know anything about file systems or Windows or UNIX or Linux or MacOS, there's really no way for them to write to files.

                  Eddy Vluggen wrote:

                  I didn't see a reference to the keyboard-based interface

                  The only way anything can show up in Note like he described is if the device worked like a keyboard.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  L 1 Reply Last reply
                  0
                  • L Lost User

                    Most card readers / scanners operate as a keyboard simply typing the read information onto the control / window that has focus. Check the API of your card reader, surely the vendor released some information.

                    Check out the CodeProject forum Guidelines[^]

                    B Offline
                    B Offline
                    bonkers123
                    wrote on last edited by
                    #10

                    Thank you very much .... I suppose I will abuse the fact that it works like a keyboard... with the same events, etc. This fact works well for me ! Thanks for your help !

                    B 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      Eddy Vluggen wrote:

                      Currently, when I open notepad and swipe a card, the information on the card is printed automatically in plain text.(Windows installed standard drivers). He can access the data as if it were a file.

                      Really? What file?? These things don't write to files. Neither do barcode scanners, laser scanners, or anything else. Since these devices do not know anything about file systems or Windows or UNIX or Linux or MacOS, there's really no way for them to write to files.

                      Eddy Vluggen wrote:

                      I didn't see a reference to the keyboard-based interface

                      The only way anything can show up in Note like he described is if the device worked like a keyboard.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #11

                      Goodmorning. Yes, you are right :)

                      I are troll :)

                      1 Reply Last reply
                      0
                      • L Lost User

                        Since you can use DirectX to highjack a normal keyboard, maybe it works here as well?

                        B Offline
                        B Offline
                        bonkers123
                        wrote on last edited by
                        #12

                        Yes you can ... this works brilliantly !

                        1 Reply Last reply
                        0
                        • B bonkers123

                          Thank you very much .... I suppose I will abuse the fact that it works like a keyboard... with the same events, etc. This fact works well for me ! Thanks for your help !

                          B Offline
                          B Offline
                          bonkers123
                          wrote on last edited by
                          #13

                          OK, so what I basically did was to abuse the fact that the card reader functions like a keyboard. I basically obtain all the devices on the computer and display them the the user. The user can then select which device is the card reader. I intercept all the messages coming from the card reader then, and set focus to the correct text box (etc) as required. A nice little thingy that I saw was, that most magnetic stripe cards end with the "return" character. So when it hits the last character, I can simply test for a return (enter), and it will fire off events that obtain my required data from the database... Thanks for all the help ! MUCH appreciated ! :) PS: For help, email me or send me a msg, I'll gladly help.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups