Answer the question
In order to leave comments, you need to log in
What can cause error 12007 when calling HttpSendRequest?
Completely identical programs compiled in Dev-Cpp (GCC) and MS VS 2008 Express work the same in Windows 7. But for some reason, only compiled in GCC works in Windows 8.1. VS2008 + W8.1 - not downloadable.
Answer the question
In order to leave comments, you need to log in
Only a debugger will help here. The reason seems to be that the GCC program carries a part of the standard library with it, while the vizhakov one takes it from Windows.
HINTERNET hInternet, hConnect, hRequest;
unsigned long readbytes = 0;
char buffer[1024];
hInternet = InternetOpen ( "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
if ( hInternet )
{
hConnect = InternetConnect( hInternet, "site.com", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0 );
if ( hConnect )
{
hRequest = HttpOpenRequest ( hConnect, "GET", url, NULL, NULL, NULL, INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_RELOAD | INTERNET_FLAG_RESYNCHRONIZE | INTERNET_FLAG_NO_UI | INTERNET_FLAG_HYPERLINK, 0 );
if ( hRequest )
{
if ( HttpSendRequest( hRequest, NULL, 0, NULL, 0 ) )
{
if ( InternetReadFile ( hRequest, buffer, 1024, &readbytes ) )
{
if ( readbytes )
{
/* ....... */
}
}
}
}
InternetCloseHandle ( hRequest );
}
InternetCloseHandle ( hConnect );
}
InternetCloseHandle ( hInternet );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question