EDN Admin
Well-known member
<span style="font-family:Verdana,Arial,sans-serif
<span style="font-size:12px; line-height:15px Hi,
I am using the following<span style="font-size:12px; line-height:15px code, and it works for binary image download, but the problem is:
<span style="font-size:12px; line-height:15px <br/>
For an image file with 18k size on server side, only 4k can be download and just half of the image can be seen on the client side. <br/>
<br/>
Any ideas?<br/>
<br/>
Thanks.
void Abc::downloadImage()
{
<span style="font-size:12px; line-height:15px DWORD dwSize = 0;
<span style="font-size:12px; line-height:15px <span style="white-space
re DWORD dwDownloaded = 0;
<span style="font-size:12px; line-height:15px <span style="white-space
re LPSTR pszOutBuffer;
<span style="font-size:12px; line-height:15px <span style="white-space
re BOOL bResults = FALSE;
<span style="font-size:12px; line-height:15px <span style="white-space
re HINTERNET hSession = NULL,
<span style="font-size:12px; line-height:15px <span style="white-space
re hConnect = NULL,
<span style="font-size:12px; line-height:15px <span style="white-space
re hRequest = NULL;
<span style="font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space
re hSession = WinHttpOpen( L"WinHTTP",
<span style="font-size:12px; line-height:15px <span style="white-space
re WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
<span style="font-size:12px; line-height:15px <span style="white-space
re WINHTTP_NO_PROXY_NAME,
<span style="font-size:12px; line-height:15px <span style="white-space
re WINHTTP_NO_PROXY_BYPASS, 0);
<span style="font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space
re if (hSession)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re hConnect = WinHttpConnect(hSession, L"localhost", INTERNET_DEFAULT_HTTP_PORT, 0);<span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="white-space
re; font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space
re if (hConnect)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re hRequest = WinHttpOpenRequest( hConnect, L"GET",
<span style="font-size:12px; line-height:15px <span style="white-space
re L"/Abc/images/a.jpg",
<span style="font-size:12px; line-height:15px <span style="white-space
re NULL, WINHTTP_NO_REFERER,
<span style="font-size:12px; line-height:15px <span style="white-space
re WINHTTP_DEFAULT_ACCEPT_TYPES,
<span style="font-size:12px; line-height:15px <span style="white-space
re WINHTTP_FLAG_REFRESH);<span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space
re if (hRequest)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re bResults = WinHttpSendRequest( hRequest,
<span style="font-size:12px; line-height:15px <span style="white-space
re WINHTTP_NO_ADDITIONAL_HEADERS, 0,
<span style="font-size:12px; line-height:15px <span style="white-space
re WINHTTP_NO_REQUEST_DATA, 0, 0, 0);
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space
re if (bResults)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re bResults = WinHttpReceiveResponse( hRequest, NULL);<span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space
re if (bResults)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re dwSize = 0;
<span style="font-size:12px; line-height:15px <span style="white-space
re if (!WinHttpQueryDataAvailable( hRequest, &dwSize))
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re printf("Error %u in WinHttpQueryDataAvailable.n", GetLastError());
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re if (dwSize > 0)
<span style="font-size:12px; line-height:15px <span style="white-space
re {<span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re pszOutBuffer = new char[dwSize+1];
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re if (!pszOutBuffer)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re printf("Out of memoryn");
<span style="font-size:12px; line-height:15px <span style="white-space
re dwSize=0;
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <span style="white-space
re else
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re if (dwSize>0)
<span style="font-size:12px; line-height:15px <span style="white-space
re {<span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re ZeroMemory(pszOutBuffer, dwSize+1);
<span style="font-size:12px; line-height:15px <span style="white-space
re if (!WinHttpReadData( hRequest, (LPVOID)pszOutBuffer, dwSize, &dwDownloaded))
<span style="font-size:12px; line-height:15px <span style="white-space
re printf("Error %u in WinHttpReadData.n", GetLastError());<span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space
re HANDLE hFile;
<span style="font-size:12px; line-height:15px <span style="white-space
re DWORD dwNumWritten;
<span style="font-size:12px; line-height:15px <span style="white-space
re BOOL bTest;
<span style="font-size:12px; line-height:15px <span style="white-space
re
<span style="font-size:12px; line-height:15px <span style="white-space
re std:
fstream outfile;
<span style="font-size:12px; line-height:15px <span style="white-space
re outfile.open("D:\1.jpg",std:
fstream::binary);
<span style="font-size:12px; line-height:15px <span style="white-space
re outfile.write(pszOutBuffer,dwSize);
<span style="font-size:12px; line-height:15px <span style="white-space
re outfile.close();
<span style="font-size:12px; line-height:15px <span style="white-space
re // Close any open handles.
<span style="font-size:12px; line-height:15px <span style="white-space
re if( hRequest )
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re WinHttpCloseHandle( hRequest );
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space
re if( hConnect)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re WinHttpCloseHandle( hConnect );
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<span style="white-space
re; font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space
re if( hSession)
<span style="font-size:12px; line-height:15px <span style="white-space
re {
<span style="font-size:12px; line-height:15px <span style="white-space
re WinHttpCloseHandle( hSession );
<span style="font-size:12px; line-height:15px <span style="white-space
re }
<div style="font-size:12px; line-height:15px }
View the full article
<span style="font-size:12px; line-height:15px Hi,
I am using the following<span style="font-size:12px; line-height:15px code, and it works for binary image download, but the problem is:
<span style="font-size:12px; line-height:15px <br/>
For an image file with 18k size on server side, only 4k can be download and just half of the image can be seen on the client side. <br/>
<br/>
Any ideas?<br/>
<br/>
Thanks.
void Abc::downloadImage()
{
<span style="font-size:12px; line-height:15px DWORD dwSize = 0;
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space

<span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space


<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <br/>
<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<span style="font-size:12px; line-height:15px <span style="white-space

<div style="font-size:12px; line-height:15px }
View the full article