InternetReadFile Problem (error 87 – The parameter is incorrect)

I have a problem here with InternetReadFile, if I run the application in a computer without proxy, the app runs ok, but if I try to use with a computer using proxy, I receive an error 87 (The parameter is incorrect).

Thats my code:

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 
} 

And I also tried to use:

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

but without success too.

Anyone knows anything about what Im doing wrong?

thankz,
erick