Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3027

ftp file size

$
0
0
My question is...can this be fixed to work right??????????????????


Code:

int index;
        CString strText;
        index = m_dir.GetCurSel();

        m_dir.GetText(index,strText);
       

       
                HINTERNET handle1 = FtpOpenFile(hIConnect,strText,GENERIC_READ,FTP_TRANSFER_TYPE_BINARY,0);
                DWORD filesized =  FtpGetFileSize(handle1,NULL);
                CString csNumber;
csNumber.Format("%lu", filesized);

MessageBox(csNumber,csNumber,MB_OK);
HANDLE hFile    = CreateFile(strText, GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
char Buffer[4024];
  DWORD dwRead =0;
 
 


m_yay.SetRange(0,filesized);
  while(InternetReadFile(handle1, Buffer, sizeof(Buffer), &dwRead) == TRUE)
  {
    if ( dwRead == 0)
      break;
    DWORD dwWrite = 0;
        progress2 += dwRead;

        m_yay.SetPos(progress2);
    WriteFile(hFile, Buffer, dwRead, &dwWrite, NULL);
  }

that code above is for a FTP CLIENT using WININET. the code is getting a file from the server and downloading...it works, but the progress bar is not working right....like it fills to fast...sometimes it doesn't even move...so can you help me with this problem

Viewing all articles
Browse latest Browse all 3027

Trending Articles