The InternetQueryDataAvailable function seems to not return what I expect. I would expect it to return the length of the file you are pointing to by hUrlFile, thus if it's 12345 bytes long then I'd expect to see this function return 12345.
It seems to return far less - as though it's loading up one buffer of data and returning the length of that instead.
Cut-down code fragment is as follows:
The value returned in dlsize does not appear to be an accurate representation of the file size being opened on the Internet.Code:HINTERNET hNet; HINTERNET hUrlFile; int bytes; LPDWORD dlsize; ... hNet = InternetOpen(is_programtitle, PRE_CONFIG_INTERNET_ACCESS, NULL, NULL, 0); ... hUrlFile = InternetOpenUrl(hNet, "http://www.angmail.fsnet.co.uk/angoid/filename.txt", NULL, 0, INTERNET_FLAG_RESYNCHRONIZE|INTERNET_FLAG_RELOAD, 0); ... bytes = InternetQueryDataAvailable(hUrlFile, &dlsize, 0, 0); ... ...
Also, does it make any difference as to whether you are accessing a simple txt file or a page pf PHP that just sends plain text back?