get size with InternetOpenUrl

How can I get the size of the document I request with InternetOpenUrl ? InternetSetFilePointer SEEK_END does not work .
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Size information is genrally not available using this API. Seeking will only work if the file is already cached, and that's your only hope with this API.

You need to write your own code to use the lower-level APIs. If the file you're reading is a FTP file, you can get the file size by doing an FtpFileFind().

If the file is an HTTP resource, you _may_ be able to get the file size by querying for the "Content-Length" header.

..B ekiM
WxWAuthor Commented:
I already know the lower level http and ftp communication . The problem is that I don't want to embedd some kbs ( and change programming style ) to only know the size of the contents .

I saw that when opening FTP , the InternetOpenUrl gets the size using the SIZE FTP command . There must be a way.
Like I said, there isn't.

Good luck with your project.

..B ekiM
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

One way i am using is

long FileSize ;
DWORD Len = sizeof ( FileSize );

Handle = HTTPOpenRequest ( .. );
HTTPSendRequest ( Handle, .. );
HTTPQueryInfo ( Handle, HTTP_QUERY_CONTENT_LENGTH, FileSize, &Len, NULL ) ;

This will work 100%.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
>This will work 100%.

WxWAuthor Commented:
I used InternetOpenUrl with HttpQuery and it works . I know there are sites that do not return the content-length ( and what I mostly hate in the net is the failure of size information and restarting to a specific position ) . I checked the thing with EE and it won't work as chensu said . However , I do believe its a SDK bug and not an EE server bug .
>I do believe its a SDK bug and not an EE server bug.

Bug? You are such a good joker.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.