|
I would start with MFC class CInternetSession.
I would prepare a CString(which creates a temp file on harddrive if Isesion stops) and download the html, have it write to the string in chunks and always GetLengh() so if the download stops, you know where to resume later.
I don't have any professional experience with this type of thing but I have used the CInternetSession. That's where I would start, I don't know if it's the best logic though. Ask for a second opinion, if you have time
Later, JoeSox www.joeswammi.com
Load my Sig here.....
|
|
|
|
|
This ATL/WTL/STL forum so my suggestion is to use ATL for it. I believe it could be safely mixed with MFC. ATL class CBindStatusCallback does most of what you are looking for.
|
|
|
|
|
You have to add a Range: header to your download request. Lets say you got 1000 bytes of a file from a previous request. Here's what you need to do
GET /somefile.zip HTTP/1.1
Range: bytes=1000-
which will start at offset 1000 bytes into the file.
Todd Smith
|
|
|
|
|
Hi,
I'm writing a program that is supposed to detect the configuration of outlook express (installed in the machine where the application is run). When I say configuration I mean the pop and smtp servers, at least. Now, reading the registry I can get that info, but the registry keys vary according to the user (right?), because different user profiles (windows 2000) can have different outllo express configurations. What I really need is to detect the configuration for the user that is executing the application.
For Example, my reg key for this is in:
HKEY_USERS\S-1-5-21-3046562155-3082545408-3971354878-2339\Software\Microsoft\Internet Account Manager\Accounts\00000001
Now, what is this number: "S-1-5-21-3046562155-3082545408-3971354878-2339"? I don't think it's going to be the same in different machines, therefore I don't seem to be able to detect what I want using the registry.
Any ideas?
Thanks!
-- narada
|
|
|
|
|
That's what HKEY_CURRENT_USER is for, it's mapped to the current user's key in HKEY_USERS .
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Sorry, this is wrong forum, right? Anyway, I appreciate your answer, still I don't know if the key is going to be the same in another machine, so how could read that programmatically?
Thanks anyway,
-- narada
|
|
|
|
|
From your first post (with my emphasis):
What I really need is to detect the configuration for the user that is executing the application.
Again, that is what HKEY_CURRENT_USER is for. The system automatically maps that hive to the key under HKEY_USERS that corresponds to the user making the call. You never have to access HKEY_USERS at all.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Yes, I see. Sorry about my confusion!
Thanks so much, I did it this way and its working fine!
-- narada
|
|
|
|
|
I try to catch events like this
class ATL_NO_VTABLE CTBar : <br />
public CComObjectRootEx<CComSingleThreadModel>,<br />
public CComCoClass<CTBar, &CLSID_TBar>,<br />
public IDispatchImpl<ITBar, &IID_ITBar, &LIBID_ATLToolBarLib, 1, 0>,<br />
public IDispEventImpl<1,CTBar,&__uuidof(DWebBrowserEvents2),&LIBID_SHDocVw>,<br />
public IObjectWithSiteImpl<CTBar><br />
public ......<br />
{<br />
<br />
BEGIN_SINK_MAP(CTBar)<br />
SINK_ENTRY_EX(1,__uuidof(DWebBrowserEvents2),DISPID_NEWWINDOW2,OnNewWindow)<br />
END_SINK_MAP()<br />
.....<br />
<br />
IUnknown* m_pSinkUnk;<br />
IWebBrowser2* m_pWebBrowser2;<br />
LPDWORD cookie;<br />
STDMETHOD (SetSite) (IUnknown*);<br />
STDMETHOD (OnNewWindow) (IDispatch** &ppDisp,VARIANT_BOOL* &Cancel);<br />
.....<br />
};<br />
<br />
<br />
STDMETHODIMP CTBar::SetSite(IUnknown* punkSite)<br />
{<br />
.....<br />
IServiceProviderPtr pServProv(punkSite);<br />
pServProv->QueryService(SID_SWebBrowserApp, IID_IWebBrowser2,(void**)&m_pWebBrowser2);<br />
this->QueryInterface (IID_IUnknown, (LPVOID*)&m_pSinkUnk);<br />
AtlAdvise(m_pWebBrowser2,m_pSinkUnk,__uuidof(DWebBrowserEvents2),cookie);<br />
.....<br />
}
but i can't. Where's the problem in this code?
|
|
|
|
|
Hi, everyone!
I am puzzled at some words taken from my STL
tutorial. Here are the words at which I am puzzled.
--------
Note: For two input iterators a and b, a == b implies *a == *b.
For istream iterators, this condition doesn't hold.
--------
My opinion is,
--------
Two istream iterators are equal if :
both are end-of-stream iterators and this can no longer be read, or
both can read and use the same stream
from "The C++ Standard Library" by Josuttis.
--------
So I think whether a and b are equal has nothing to do
with *a and *b. Another question, "input iterators" is
different from "istream iterators"? I think they are the same.
Am I correct? Who can give me an explanation?
Better with an example.
Thanks in advance,
George
|
|
|
|
|
Note: For two input iterators a and b, a == b implies *a == *b.
This is just false. The only requisite about == for input iterators is that it should be an equivalence relation.
both are end-of-stream iterators and this can no longer be read, or
both can read and use the same stream.
This is absolutely right.
Another question, "input iterators" is different from "istream iterators"?
No, an istream_iterator is an input iterator, but an input iterator is not necessarily an istream_iterator (for instance, a pointer is an input iterator).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, Joaquín buddies!
As you said,
--------
This is just false. The only requisite about == for input iterators is that it should be an equivalence relation.
--------
Do you mean that what tutorial is saying is not correct?
What puzzled me most is the meaning of "equivalence relation". What do you mean "equivalence relation"?
Because I think I can give you an example when a == b, while the same time *a != *b.
Thanks in advance,
George
|
|
|
|
|
Of course you can give that example An equivalence relation, if you remember from your Math classes, is just a relation being reflexive, symmetric and transitive. With regard to our particular problem, this means thati==i always evaluates to true ,
- if
i==j then j==i ,
- if
i==j and j==k then i==k .
As you can see, expressions of the type *i are not involved in this definition.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, Joaquín buddies!
I think you mis-understand my question. My
origin question is, the tutorial said,
--------
if( (i == j) && (i and j are both input iterators) )
then
(*i == *j)
endif
--------
My question is not that I do not understand what means
"equivalence relation".
What is your opinion about the tutorial? Is it correct?
Thanks in advance,
George
|
|
|
|
|
--------
if( (i == j) && (i and j are both input iterators) )
then
(*i == *j)
endif
-------- This is false. The tutorial is wrong. The only requisite about == for input iterators in general is the equivalence relation stuff, as you pointed out before.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks, Joaquín buddies!
George
|
|
|
|
|
I have what is probably a simple question, but I am stuck and need help. I am trying to create an Options dialog box for an app. I am using WTL to create the app. I have added the tab control, but I need a quick way to select the controls for each page. In VB I would create a group control and add the controls to the group, then show and hide the group as needed. I can't seem to make this work in WTL (probably doing something wrong with adding the controls to the group). I also, think that I might be able to use a dialog resource like a property sheet, but I am at a loss at how to get this added to the Tab Control. What is the best way to proceed?
Thanks for any help you can give.
Leo T. Smith
|
|
|
|
|
This is probably not the answer you’re looking for but, as far as I know, the way groups work in VB is just that, a VB thing. There is no parallel functionality in the rest of windows programming. The closest you could come would be to store a list of all the controls in the 'group' you want to modify and simply hide/shoe them when necessary.
Besides, the thing you probably want to be doing, as you mentioned, is create a property sheet. There are some samples of this on this site:
Using DDX and DDV with WTL[^]
It does concern itself with a more advance topic, but the code for using both property sheets and property pages is in there.
cheers,
-B
|
|
|
|
|
Hi, everyone!
Here are the sentences taken from my STL tutorial,
--------
Any value of an output iterator may have at most one active copy at any given time.
// i and j are output iterators
// a and b are values written to a iterator position
i = j;
*i++ = a;
*j = b;
is not a valid code sequence.
--------
I write a piece of code by myself tried the codes and
run it. I find it runs OK! So I doubted what is the tutorial
talking about. Can anyone explain it to me? (What means "at most one active copy at any given time" ?)
Here is my sample,
--------
#include <iterator>
#include <fstream>
#include <iostream>
using namespace std;
void main()
{
ofstream ofile ("c:\\file1.txt");
ostream_iterator<int> i (ofile);
ostream_iterator<int> j (ofile);
// i and j are output iterators
// a and b are values written to a iterator position
*i++ = 1;
*j = 2;
}
--------
Thanks in advance,
George
|
|
|
|
|
The semantics of output iterators are simple, and it reduces to the following rule: a given position has to be accessed once and only once. Let us examine why the following pieces of code are incorrect:
*i=5;
++i;
++i; This is incorrect as you're "skipping" a value.
*i=5;
*i=6; Wrong, as you're assigning to the same position twice.
j=i;
*i++=1;
*j=2; Wrong, for the same reason as before.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, Joaquín buddies!
In the last sample,
--------
j=i;
*i++=1;
*j=2;
--------
i and j are referencing to the same stream but
they are different iterators. I still doubted
why they are assigning to the same position twice?
Since they are different iterators and I think it
is like two pointers pointing to the same memory.
Can you give me an explanation?
Thanks in advance,
George
|
|
|
|
|
No, wait. I've reread the standard and now I think the above piece of code is correct. Sorry.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, Joaquín buddies!
Do you mean that the tutorial is
not correct? Since the tutorial says
that the piece of code is not correct.
Thanks in advance,
George
|
|
|
|
|
Hi, Joaquín buddies!
Have you found the answer?
Thanks in advance,
George
|
|
|
|
|
Hi, everyone!
Here is a simple STL program. It uses two input iterators
to use on the same input file. I do not understand why the
output is looking like this.
Here are the source codes,
--------
#include <iterator>
#include <fstream>
#include <iostream>
using namespace std;
void main()
{
// c:\\file1.txt: 0 1 2 3
ifstream ifile ("c:\\file1.txt");
istream_iterator<int> r (ifile);
istream_iterator<int> s (ifile);
(r==s) ? cout << "equal" : cout << "not equal";
cout << endl;
++r;
++s;
cout << *r << endl;
cout << *s << endl;
(r==s) ? cout << "equal" : cout << "not equal";
cout << endl;
}
--------
Here are the outputs,
--------
equal
2
3
equal
--------
Thanks in advance,
George
|
|
|
|
|