Click here to Skip to main content
15,921,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Show / Hide controls on a dialog Pin
Hamid_RT31-Jul-07 19:50
Hamid_RT31-Jul-07 19:50 
QuestionA question about lib files. Pin
mt_samiei22-Jul-07 3:41
mt_samiei22-Jul-07 3:41 
AnswerRe: A question about lib files. Pin
Abhijeet Pathak22-Jul-07 4:33
Abhijeet Pathak22-Jul-07 4:33 
QuestionTransfer a File through Socket with CArchive Pin
glemaire22-Jul-07 3:02
glemaire22-Jul-07 3:02 
AnswerRe: Transfer a File through Socket with CArchive Pin
Mark Salsbery22-Jul-07 8:19
Mark Salsbery22-Jul-07 8:19 
GeneralRe: Transfer a File through Socket with CArchive Pin
glemaire22-Jul-07 22:21
glemaire22-Jul-07 22:21 
GeneralRe: Transfer a File through Socket with CArchive Pin
Mark Salsbery23-Jul-07 5:14
Mark Salsbery23-Jul-07 5:14 
QuestionWinInet + "POST" request - how to make progress bar for uploading file? Pin
chox_nox22-Jul-07 0:17
chox_nox22-Jul-07 0:17 
Hi,

I'm using WinInet APIs in async mode to upload files to server using HTTP protocol and "POST" request. As a matter of fact, I'm trying to simulate HTML form (multipart data) submit button.

I can successfully send file, but I have problem with making progress bar while uploading.
Here is code I'm using for sending:
while (dwReadLength != 0)
{
    DWORD dwBytesSent = 0;
dwReadLength = fileLocal.Read(pBuffer, dwChunkLength);

if (dwReadLength != 0)
{
    if (!InternetWriteFile(hInternetFile, pBuffer, dwReadLength, &dwBytesWritten))
        {
        if (::GetLastError() != ERROR_IO_PENDING)
    {
        strError.Format("CFileHostingHttpUpload::UploadFile::InternetWriteFile(2) = %d",
                    ::GetLastError());
        return FALSE;
    }
    WaitForSingleObject(hAsyncOp, INFINITE);
    }
        dwTotalRead+=dwBytesWritten;

        pbUpload->SetPos(((double)dwTotalRead/dwTotalRequestLength)*100);
}
}

The problem is that my progress bar gets fully "progressed" in about 1-2 seconds, but file uploading is far slower (25kb/s upload speed). When I track transfer with net sniffer tool I can see that it takes about 10 seconds to upload 256 kb file, but progress bar gets fill almost instantly. I've tried about 6-7 different upload "loops" but all of them are giving almost same result.

InternetStatusCallback gives me this:
<br />
11:49:19 - Connected to server.<br />
11:49:19 - Sending request ...<br />
11:49:19 - Request sent: 186 bytes<br />
11:49:19 - Request complete.<br />
11:49:19 - Sending request ...<br />
11:49:19 - Request sent: 86 bytes<br />
11:49:19 - Sending request ...<br />
11:49:19 - Request sent: 4096 bytes<br />
...<br />
... (a lot of same status until the end of upload, no need to paste them all :))<br />
...<br />
11:49:19 - Sending request ...<br />
11:49:19 - Request sent: 4096 bytes<br />
11:49:19 - Sending request ...<br />
11:49:19 - Request sent: 4096 bytes<br />
11:49:19 - Request complete.<br />
11:49:19 - Sending request ...<br />
11:49:19 - Request sent: 802 bytes<br />
11:49:19 - Sending request ...<br />
11:49:19 - Request sent: 16 bytes<br />
11:49:19 - Receiving response ...<br />
11:49:29 - Response received: 1024 bytes<br />
11:49:29 - <br />
11:49:29 - Request complete.<br />


Does anybody have any kind of solution?

Best Regards and have a nice day!
Questionmoving a mfc app into a dll Pin
DevMentor.org21-Jul-07 23:11
DevMentor.org21-Jul-07 23:11 
AnswerRe: moving a mfc app into a dll Pin
#realJSOP22-Jul-07 0:16
professional#realJSOP22-Jul-07 0:16 
GeneralRe: moving a mfc app into a dll Pin
DevMentor.org22-Jul-07 8:32
DevMentor.org22-Jul-07 8:32 
AnswerRe: moving a mfc app into a dll Pin
Mark Salsbery22-Jul-07 9:15
Mark Salsbery22-Jul-07 9:15 
GeneralRe: moving a mfc app into a dll Pin
DevMentor.org22-Jul-07 9:35
DevMentor.org22-Jul-07 9:35 
GeneralRe: moving a mfc app into a dll Pin
Mark Salsbery22-Jul-07 9:39
Mark Salsbery22-Jul-07 9:39 
GeneralRe: moving a mfc app into a dll Pin
DevMentor.org22-Jul-07 9:55
DevMentor.org22-Jul-07 9:55 
GeneralRe: moving a mfc app into a dll Pin
Mark Salsbery22-Jul-07 10:05
Mark Salsbery22-Jul-07 10:05 
GeneralRe: moving a mfc app into a dll Pin
DevMentor.org22-Jul-07 10:17
DevMentor.org22-Jul-07 10:17 
AnswerRe: moving a mfc app into a dll Pin
DevMentor.org23-Jul-07 10:39
DevMentor.org23-Jul-07 10:39 
Questionhow to get Cwnd object Pin
Max++21-Jul-07 21:46
Max++21-Jul-07 21:46 
AnswerRe: how to get Cwnd object Pin
#realJSOP22-Jul-07 0:27
professional#realJSOP22-Jul-07 0:27 
AnswerRe: how to get Cwnd object Pin
ThatsAlok22-Jul-07 17:56
ThatsAlok22-Jul-07 17:56 
AnswerRe: how to get Cwnd object Pin
Hamid_RT31-Jul-07 19:48
Hamid_RT31-Jul-07 19:48 
Questionerror C2061: syntax error : identifier 'search' Pin
jt900021-Jul-07 18:31
jt900021-Jul-07 18:31 
AnswerRe: error C2061: syntax error : identifier 'search' Pin
Abhijeet Pathak22-Jul-07 4:41
Abhijeet Pathak22-Jul-07 4:41 
QuestionHow to get all the export functions of a dll Pin
kcynic21-Jul-07 17:37
kcynic21-Jul-07 17:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.