|
Hi, everyone!
I want to get HTTP response header of my HTTP request.
I have seen some documents in MSDN, but I think it is
too hard to understand.
I just want to get all of the header and print it out.
Are there some sample codes?
Cheers,
George
|
|
|
|
|
|
Thanks, Ravi pal!
I have seen the article you introduced to me.
It really helps a lot!
Cheers,
George
|
|
|
|
|
Thanks, Ravi pal!
I have a further question. I use the following codes to
get the header of Yahoo,
--------
CAmHttpSocket http;
TCHAR *ts = http.GetHeaders(_T("http://www.yahoo.com"));
CString str = ts;
AfxMessageBox(ts);
}
--------
in the message box, I can only get
--------
HTTP/1.1 200 OK
--------
I can not get other headers (Content-Length, and cookies etc).
Can you tell me how can I get all of the headers?
Have a nice weekend,
George
|
|
|
|
|
The headers received depends on the webserver. Many webservers will only respond with a minimal subset and may also change headers (like the document's last-updated timestamp) to fool you.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks, Ravi pal!
I use "curl" command in Linux and can see all the headers, but
by using this tool, I can only see one of the headers.
I wondered whether I have miss-used the lib?
Can you check my code?
Cheers,
George
|
|
|
|
|
What function are you using to send an HTTP request? Some of the IE technologies don't allow you to get the response header.
Todd Smith
|
|
|
|
|
Thanks, Todd pal!
I am not using any specific browser. I just want to use
some client technology to see whether my web server runs
properly.
Do you have some ideas?
Cheers,
George
|
|
|
|
|
In that case here's the easiest way to get a response header
[www@staging2 apache]$ telnet www.codeproject.com 80
Trying 207.219.70.31...
Connected to www.codeproject.com (207.219.70.31).
Escape character is '^]'.
GET /index.html HTTP/1.1
host: test
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Fri, 25 Oct 2002 16:46:38 GMT
Content-Length: 20307
Content-Type: text/html
Set-Cookie: LastVisit=10%2F25%2F2002+12%3A46%3A38+PM; expires=Wed, 23-Apr-2003 04:00:00 GMT; path=/
Set-Cookie: ASPSESSIONIDGQGGQZSK=LIPJNILADKDFHFMELBMDCJHE; path=/
Cache-control: private
Todd Smith
|
|
|
|
|
I found out how to display colored text in a rich edit control but am having a problem retaining the colored text when doing a ReplaceSel().
Is this normal? Is there a way around it? I mean is there another way of adding lines of text to a rich edit control without doing ReplaceSel?
I would like to keep adding text to this rich edit control and am using a method described here where you SetSel(0,-1), GetSelText(), then add my new text to it, and call ReplaceSel() to replace the entire contents of the rich edit control with the old and new text. But, if my old text was colored (only certain portions or certain lines are of different colors), the text is being overwritten to the default color - black text.
|
|
|
|
|
Hi,
A quick question with regards the above:
Can one use Crystal Reports in Visual C++?
And if so how does one go about doing that?
Thanks
Regards
Rui
|
|
|
|
|
You've a C++ SDK[^].
How low can you go ? (MS rant)
|
|
|
|
|
Yes you can do that.
Via COM it is possible to open reports, show them in a window (in a Crystal Reports Viewer ActiveX control), and perform all kinds of actions on it (print, mail, ...).
It is even possible to show the embeddable designer, and let you users design their own reports; within your application (although you need a separate license for this).
Normally the data for your report will come from a database (that's easy), but it's even possible to tell Crystal Reports that the data comes from within your application. However be careful, since CR 9.0 does not support the same functionality as CR 8.5. If you want to do this I suggest to go to CR 9.0 directly.
When you only want to show the report in your application, you don't have to pay any runtime royalty to CR (you can ship a free CR View-Only Runtime). However, if you want to create or modify reports from within your application, or let the user create or modify reports, you need a special RCAPI (Report Creation (or was it Component) API) license. This license is per named user, and costs about the same as a full Crystal Reports. This license and the Design-Time RunTime is mandatory ! simply installing Crystal Reports won't do the job.
Best way to get more information is to look at the crystal reports site, especially the developer zone (http://www.crystaldecisions.com/products/dev_zone[^]).
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
Hi Patje,
THank you very much for the information. May I ask you something else: The Crystal Reports that comes with Studio .Net, how does this fit in with what you are saying?
I notice that one can create a crystal report item for a C++ application, would this be the report that is called by the Crystal Reports Viewer ActiveX control?
Thanks
Regards
|
|
|
|
|
I don't know anything about the CR that comes with VS.Net, but I assume that it's a kind 8.5.Net version, not the brand new CR 9.0.
We are using the CR ActiveX control by using the "AtlAxWin" control (part of ATL 3.0) and passing it
- "CrystalReport.EmbeddableCrystalReportsDesignerCtrl.8.5" for the embeddable designer
- "CRViewer.CRViewer.8.0" for the ActiveX viewer
Then use ATL::AtlAxGetControl to get the IUnknown interface of the ActiveX control hosted in the AtlAxWin control.
ATL::AtlAxGetControl (NativeWin, &UnknownInterface);
Then use IUnknownInterface->QueryInterface to get the interface to the CRVIEWERLib::ICrystalReportViewer4Ptr.
hr = UnknownInterface->QueryInterface (__uuidof(CRVIEWERLib::ICrystalReportViewer4),(void **)&CrystalReportViewer);
or for the designer:
hr = UnknownInterface->QueryInterface (__uuidof(CRDESIGNERCTRLLib::ICRDesignerCtrl),(void **)&CrystalReportDesigner);
Then simply use
CrystalReportViewer->ReportSource = MyReport
to set the report in the viewer (similar for the designer).
Don't forget to import the necessary type libraries:
#import "CRAXDDRT.tlb"
#import "CRAXDRT.tlb"
#import "crviewer.tlb"
#import "CRDesignerCtrl.tlb"
Also take a look at the generated .tli and .tlh files (by the #import). They're also very interesting if you want to know some of the more technical details.
Hope this helps (this was one of my first C++/COM projects, a real C++/COM guru might write this maybe a bit more efficient).
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
Hi guys
How can I change the color of the EditBox part of a CComboBox?
I don't want to change the list color, only the edit box part.
Best regards
Jordi
|
|
|
|
|
Probably wanna look into CWnd::OnCtlColor as one solution...and by far the easiest...
There is also Ownerdrawing as an option, but thats ALOT of work...
So look into the above first
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hello,
i have to write an activex-control, that can recieve the rate of exchange for a securitypaper from a server in the internet. But at this time i have no idea how to access a server and how to recieve the information. Has anyone out there an idea or can give me a link to a description how to do this. Help would be very appreciated.
Best regards
tabor25
|
|
|
|
|
HI
How can i calculate that how much length and height of any text will take
with any font before displaying with Device Context.
thanks in anticipation for any hint or solutions.
bye.
|
|
|
|
|
You can use GetTextExtentPoint32 (API) or CDC::GetTextExtent (MFC) for that purpose.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
i am to set the size of font such that specified text always comes with in
some specified rectangle. for this purpose i am using
CSize sz =pDC->GetOutputTextExtent(*txt);
it works . but problem is that it is very slow as there are many times font
is to be selected in pDC with a higher font size.
has any body done it in some other way or some hint.
All i want is to display text in a rectangle making the size of the
font such that text fits in the rectangle.
thanks in anticipation.
|
|
|
|
|
This is actually a reply to your next question, but the way the threads unfolded that would require me to click back and i'm to lazy...
So...
I would suggest looking into using DrawText() with the DT_CALCRECT style...
With this you can specify the width of the required rectangle and the geven text and it will calculate the height required for full display...very cool!!!
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi,
How can I make simple textlinks in my AboutDlg?
For example; "Visit my homepage at http://icc.makes.it"
Thanks
/Ola Carlsson
|
|
|
|
|
There are several solutions. Consider these Win32 API.
CreateProcess()
ShellExecute()
WinExec()
In general, you will pass in a null-terminated string of the URL. CreateProcess() will require iexplorer.exe in addition to the URL.
Kuphryn
|
|
|
|
|
Take a look at Chris Maunder's excellent Hyperlink Control[^]
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|