Is OLE automation a good choice to automate IE via C++?
I am new to machine-oriented programming and..
I want to open a website in IE - download the whole content of that site - and save it to a specified temporary file. What is the best way to do this with pure开发者_StackOverflow中文版 C++? Any suggestions and / or examples? I stumbled over OLE automation. Would that be a good choice?
Sencerely, Konstanze
If you want 'pure' C++ then automation's your best shot.
You could also do this in C++/CLI.
http://msdn.microsoft.com/en-us/library/aa752044(v=vs.85).aspx
Scroll to the bottom for C++ samples.
Also, familiarize yourself with the basic concepts of COM before you move forward.
You are better off:
- opening a HTTP connection to the page you want to download;
- open a write handle to the temporary file;
- read the connection data into a temporary buffer;
- write the content of the buffer to the file handle from (2);
- repeat steps (3) and (4) in a loop until there is no more data;
- close the file and http connection handles.
You should be able to google for the APIs to use (IIRC, something like HttpOpen on windows).
精彩评论