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. How do I copy a file and display progress?

How do I copy a file and display progress?

Scheduled Pinned Locked Moved C#
questionjsontutorial
4 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.
  • T Offline
    T Offline
    Tony Archer
    wrote on last edited by
    #1

    Anyone know how to initiate a file copy and display the progress of said copy? I can't figure out how to use the CopyFileEx API and it's callback. That's the only way I've seen to do this. --Tony Archer "I can build it good, fast and cheap. Pick any two."

    G D 2 Replies Last reply
    0
    • T Tony Archer

      Anyone know how to initiate a file copy and display the progress of said copy? I can't figure out how to use the CopyFileEx API and it's callback. That's the only way I've seen to do this. --Tony Archer "I can build it good, fast and cheap. Pick any two."

      G Offline
      G Offline
      Guinness4Strength
      wrote on last edited by
      #2

      you can open the file manually get the size and copy it in set sized buffers to another file you created, using a progress bar to show the progress.

      1 Reply Last reply
      0
      • T Tony Archer

        Anyone know how to initiate a file copy and display the progress of said copy? I can't figure out how to use the CopyFileEx API and it's callback. That's the only way I've seen to do this. --Tony Archer "I can build it good, fast and cheap. Pick any two."

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

        It is the only way, unless you want to write your own file copy class with a dialog that shows progress. Post the code that your using, including the DllImport, to call the function so we can figure out what your doing wrong. You don't need to supply a callback to the function. If you don't supply one (pass in null in that parameter), the CopyFileEx function will display it's own progress dialog. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        J 1 Reply Last reply
        0
        • D Dave Kreskowiak

          It is the only way, unless you want to write your own file copy class with a dialog that shows progress. Post the code that your using, including the DllImport, to call the function so we can figure out what your doing wrong. You don't need to supply a callback to the function. If you don't supply one (pass in null in that parameter), the CopyFileEx function will display it's own progress dialog. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          J Offline
          J Offline
          Jonathan Slenders
          wrote on last edited by
          #4

          Hi, thats exactly what i figured out i few days before. I developed a filebrowser. And it also contains a dialog for copying files and it shows the progress. Look to class copydialog of the file clipboard.cs.

          Download from www.slenders.be

          It also contains examples for moving files, copying folders, etc.

          Just take a look

          Jonathan Slenders

          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