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. Moving file with progress

Moving file with progress

Scheduled Pinned Locked Moved C / C++ / MFC
announcement
6 Posts 4 Posters 4 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.
  • S Offline
    S Offline
    sarfaraznawaz
    wrote on last edited by
    #1

    hi am looking to move the existing file along with progress control update . i tried with movefilewithprogrees did not work . canany body explain the concept

    movefilewithprogrees

    how it work or any alternate way for moving the file with progress update . this movefilewithprogress will move the file if i get how much this function will transfer the data . Best Regards sarfaraz

    M L D 3 Replies Last reply
    0
    • S sarfaraznawaz

      hi am looking to move the existing file along with progress control update . i tried with movefilewithprogrees did not work . canany body explain the concept

      movefilewithprogrees

      how it work or any alternate way for moving the file with progress update . this movefilewithprogress will move the file if i get how much this function will transfer the data . Best Regards sarfaraz

      M Offline
      M Offline
      Malli_S
      wrote on last edited by
      #2

      Can you please post your code snipet? For your conceptual study, you can have a look at this[^].

      [Delegates]      [Virtual Desktop]      [Tray Me !]
      -Malli...! :rose:****

      1 Reply Last reply
      0
      • S sarfaraznawaz

        hi am looking to move the existing file along with progress control update . i tried with movefilewithprogrees did not work . canany body explain the concept

        movefilewithprogrees

        how it work or any alternate way for moving the file with progress update . this movefilewithprogress will move the file if i get how much this function will transfer the data . Best Regards sarfaraz

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

        sarfaraznawaz wrote:

        i tried with movefilewithprogrees did not work .

        You need to explain what it was that did not work, we cannot guess. Have you checked the documentation[^] to ensure that your function call is correct and also checked for any error responses?

        One of these days I'm going to think of a really clever signature.

        1 Reply Last reply
        0
        • S sarfaraznawaz

          hi am looking to move the existing file along with progress control update . i tried with movefilewithprogrees did not work . canany body explain the concept

          movefilewithprogrees

          how it work or any alternate way for moving the file with progress update . this movefilewithprogress will move the file if i get how much this function will transfer the data . Best Regards sarfaraz

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          sarfaraznawaz wrote:

          i tried with movefilewithprogrees did not work .

          Which is all but totally meaningless without showing how you are using that function, and what GetLastError() is returning. We're not mind readers!

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

          S 1 Reply Last reply
          0
          • D David Crow

            sarfaraznawaz wrote:

            i tried with movefilewithprogrees did not work .

            Which is all but totally meaningless without showing how you are using that function, and what GetLastError() is returning. We're not mind readers!

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

            S Offline
            S Offline
            sarfaraznawaz
            wrote on last edited by
            #5

            see i tried like this but it does not coming in callback function . so that i use while loop to update the progress

            <pre>DWORD CALLBACK CopyProgressRoutine(LARGE_INTEGER TotalFileSize,LARGE_INTEGER TotalBytesTransferred,LARGE_INTEGER StreamSize,
            LARGE_INTEGER StreamBytesTransferred,DWORD dwStreamNumber,DWORD dwCallbackReason,
            HANDLE hStoreFile,HANDLE hFinalFile,LPVOID lpData)
            {

            Temp\_TotalBytesTransferred.QuadPart = TotalBytesTransferred.QuadPart;
            Temp\_TotalFileSize.QuadPart=TotalFileSize.QuadPart;
            iNewPercent1 = int(( double(TotalBytesTransferred.QuadPart) /
            	double(TotalFileSize.QuadPart) ) \* 100);
            return PROGRESS\_CONTINUE;
            

            }</pre><pre lang="cs">while(savingbytetraversed<=m_li64FileSize.QuadPart)
            {

                        ::SendMessage(h\_wnd,WM\_APP + 12, 0,0);
                        savingbytetraversed+=10;
                        ullBytesTraversed = savingbytetraversed;
                        if (bSaveexecution  == 0)
                        {
                            successForsavingfile == FALSE;
                            break;
                        }
                    }
                    if (savingbytetraversed &gt;= m\_li64FileSize.QuadPart )
                    {
                        successForsavingfile =TRUE;
                        ::SendMessage(h\_wnd,WM\_APP + 12, 0,0);
                        MoveFileWithProgress(FilePathForSaving,pathforsaving,
                            CopyProgressRoutine, NULL, MOVEFILE\_COPY\_ALLOWED);
                        ::MessageBox(h\_wnd,\_T(&quot;File Saved successfully &quot;),\_T(&quot;Information &quot;),MB\_ICONINFORMATION);
                        successForsavingfile = FALSE;
                        closefile= FALSE;
            
                    }</pre>
            
            D 1 Reply Last reply
            0
            • S sarfaraznawaz

              see i tried like this but it does not coming in callback function . so that i use while loop to update the progress

              <pre>DWORD CALLBACK CopyProgressRoutine(LARGE_INTEGER TotalFileSize,LARGE_INTEGER TotalBytesTransferred,LARGE_INTEGER StreamSize,
              LARGE_INTEGER StreamBytesTransferred,DWORD dwStreamNumber,DWORD dwCallbackReason,
              HANDLE hStoreFile,HANDLE hFinalFile,LPVOID lpData)
              {

              Temp\_TotalBytesTransferred.QuadPart = TotalBytesTransferred.QuadPart;
              Temp\_TotalFileSize.QuadPart=TotalFileSize.QuadPart;
              iNewPercent1 = int(( double(TotalBytesTransferred.QuadPart) /
              	double(TotalFileSize.QuadPart) ) \* 100);
              return PROGRESS\_CONTINUE;
              

              }</pre><pre lang="cs">while(savingbytetraversed<=m_li64FileSize.QuadPart)
              {

                          ::SendMessage(h\_wnd,WM\_APP + 12, 0,0);
                          savingbytetraversed+=10;
                          ullBytesTraversed = savingbytetraversed;
                          if (bSaveexecution  == 0)
                          {
                              successForsavingfile == FALSE;
                              break;
                          }
                      }
                      if (savingbytetraversed &gt;= m\_li64FileSize.QuadPart )
                      {
                          successForsavingfile =TRUE;
                          ::SendMessage(h\_wnd,WM\_APP + 12, 0,0);
                          MoveFileWithProgress(FilePathForSaving,pathforsaving,
                              CopyProgressRoutine, NULL, MOVEFILE\_COPY\_ALLOWED);
                          ::MessageBox(h\_wnd,\_T(&quot;File Saved successfully &quot;),\_T(&quot;Information &quot;),MB\_ICONINFORMATION);
                          successForsavingfile = FALSE;
                          closefile= FALSE;
              
                      }</pre>
              
              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              You're calling MoveFileWithProgress() from within the callback function?

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

              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