0

ここで InternetReadFile に問題があります。プロキシのないコンピューターでアプリケーションを実行すると、アプリは正常に動作しますが、プロキシを使用するコンピューターで使用しようとすると、エラー 87 (パラメーターが正しくありません) が表示されます。

それは私のコードです:

conHandle = InternetOpen("Test", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); 
... 
hFile = InternetOpenUrl(conHandle, url.c_str(), NULL, 0, INTERNET_FLAG_RELOAD, 0);  
... 

if (!InternetReadFile(hFile, buffer, maxBufferSize, &size)) 
{ 
    // error 
} 

そして、私も使用しようとしました:

InternetOpen("Test", INTERNET_OPEN_TYPE_PROXY, "proxystr", NULL, 0); 

しかし、成功もありません。

誰が私が間違っているかについて何か知っていますか?

ありがとう、エリック

4

2 に答える 2

1

TRUE が返され、読み取られたバイト数が 0 になるまで、InternetReadFile をループで呼び出し続ける必要があります。これは通常、InternetReadFile を少なくとも 2 回呼び出すことを意味します。

while ( InternetReadFile( hFile, buffer, maxBufferSize, &size ) == FALSE || size > 0 )
{
   // process buffer contents.
   // for ex: write the contents of buffer to a temp file for example.
}
于 2009-08-17T10:18:38.937 に答える
0

そのはず:

while (InternetReadFile(hFile, buffer, maxBufferSize, &size) == TRUE || size > 0)
{
   // process buffer contents.
   // for ex: write the contents of buffer to a temp file for example.
}
于 2009-10-01T10:17:43.323 に答える