Jump to content
  • Advertisement
Sign in to follow this  
Teric

WinINet: Handle in Incorrect State?

This topic is 4672 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm running WinINet function calls in async mode. I've set up a callback handler to get internet status messages. I make a call to InternetOpenURL like so:
InternetOpenUrl(m_hInternet,
                (const char*)ModelInfo->RemoteFilePath,
                NULL,
                0,
                INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_NO_CACHE_WRITE,
                (LPARAM)ModelInfo);
In the callback, when I get a INTERNET_STATUS_HANDLE_CREATED message, I grab the handle and put it into DLInfo->hFile (an HINTERNET variable), then immediately make a call to HttpQueryInfo like this:
char strFileSize[32];
DWORD dwStrLength = sizeof(strFileSize);
BOOL RetCode = HttpQueryInfo(DLInfo->hFile, HTTP_QUERY_CONTENT_LENGTH, strFileSize, &dwStrLength, NULL);
The call the HttpQueryInfo immediately returns false, and GetLastError gives me 12019, ERROR_WINHTTP_INCORRECT_HANDLE_STATE (The requested operation cannot be carried out because the handle supplied is not in the correct state.) The handle's value was 0x00cc000c. Any idea what this means? Thanks in advance! [Edited by - Teric on September 2, 2005 1:08:09 AM]

Share this post


Link to post
Share on other sites
Advertisement
Anyone have an idea what would cause an HINTERNET handle to be in an incorrect state (i.e. ERROR_WINHTTP_INCORRECT_HANDLE_STATE)?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://msdn.microsoft.com/library/en-us/wininet/wininet/asynchronous_operation.asp

The section "Functions that can be used asynchronously" doesn't list HttpQueryInfo. Don't know if that's true and if it's your problem. To get more help I suggest you post sample code that is possible to download and build directly to reproduce your problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!