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 / C++ / MFC
  4. USB Data

USB Data

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
8 Posts 2 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.
  • M Offline
    M Offline
    mirtu
    wrote on last edited by
    #1

    Hi Experts How can i read and write data from USB.Plz help me..

    C 1 Reply Last reply
    0
    • M mirtu

      Hi Experts How can i read and write data from USB.Plz help me..

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      You don't do that directly. You have to communicate with one of the device sitting on the bus through its device driver, and you can't access the bus directly. Which device are you trying to communicate with ? The way to go is to get a handle to the driver through CreateFile (you simply the device symbolic name) and then you can call ReadFile and WriteFile or exchange specific control codes by calling DeviceIOControl. All of those things are specific to the device you try to communicate with, so you need to have some documentation.

      Cédric Moonen Software developer
      Charting control [v1.4] OpenGL game tutorial in C++

      M 1 Reply Last reply
      0
      • C Cedric Moonen

        You don't do that directly. You have to communicate with one of the device sitting on the bus through its device driver, and you can't access the bus directly. Which device are you trying to communicate with ? The way to go is to get a handle to the driver through CreateFile (you simply the device symbolic name) and then you can call ReadFile and WriteFile or exchange specific control codes by calling DeviceIOControl. All of those things are specific to the device you try to communicate with, so you need to have some documentation.

        Cédric Moonen Software developer
        Charting control [v1.4] OpenGL game tutorial in C++

        M Offline
        M Offline
        mirtu
        wrote on last edited by
        #3

        Thx's for reply can you give document or example code.If it is possible(document or code) then plz give me.. Thx's

        C 1 Reply Last reply
        0
        • M mirtu

          Thx's for reply can you give document or example code.If it is possible(document or code) then plz give me.. Thx's

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          No I can't because it is specific to the device you are trying to access. So, please answer my question: which device are you trying to communicate with ? Normally, you should have some documentation supplied with the device.

          Cédric Moonen Software developer
          Charting control [v1.4] OpenGL game tutorial in C++

          M 1 Reply Last reply
          0
          • C Cedric Moonen

            No I can't because it is specific to the device you are trying to access. So, please answer my question: which device are you trying to communicate with ? Normally, you should have some documentation supplied with the device.

            Cédric Moonen Software developer
            Charting control [v1.4] OpenGL game tutorial in C++

            M Offline
            M Offline
            mirtu
            wrote on last edited by
            #5

            ok iwant to access all device but first i want to access PenDrive.So plz help me

            C 1 Reply Last reply
            0
            • M mirtu

              ok iwant to access all device but first i want to access PenDrive.So plz help me

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              mirtu wrote:

              ok iwant to access all device

              :confused: Why do you want to do that ? What do you want to do with those devices if you don't know how to communicate with them ?

              mirtu wrote:

              but first i want to access PenDrive

              You can simply access the files the standard way. The driver takes care of everything. The only thing a bit more tricky would be to know which driver letter is used by the device, but I don't know exactly how to do that. I guess you should check somewhere in the registry.

              Cédric Moonen Software developer
              Charting control [v1.4] OpenGL game tutorial in C++

              M 1 Reply Last reply
              0
              • C Cedric Moonen

                mirtu wrote:

                ok iwant to access all device

                :confused: Why do you want to do that ? What do you want to do with those devices if you don't know how to communicate with them ?

                mirtu wrote:

                but first i want to access PenDrive

                You can simply access the files the standard way. The driver takes care of everything. The only thing a bit more tricky would be to know which driver letter is used by the device, but I don't know exactly how to do that. I guess you should check somewhere in the registry.

                Cédric Moonen Software developer
                Charting control [v1.4] OpenGL game tutorial in C++

                M Offline
                M Offline
                mirtu
                wrote on last edited by
                #7

                ok Plz tell me what information you want to know from me. I got code from codeproject.com which is give information about USB Port Attached device.Link is this [code] http://www.codeproject.com/KB/system/HwDetect.aspx[^] [/code] So if it is possible then help me

                M 1 Reply Last reply
                0
                • M mirtu

                  ok Plz tell me what information you want to know from me. I got code from codeproject.com which is give information about USB Port Attached device.Link is this [code] http://www.codeproject.com/KB/system/HwDetect.aspx[^] [/code] So if it is possible then help me

                  M Offline
                  M Offline
                  mirtu
                  wrote on last edited by
                  #8

                  Plz help me any..

                  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