Click here to Skip to main content
15,914,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Ports Pin
<k>Andreas Hoheisel13-Aug-01 21:06
<k>Andreas Hoheisel13-Aug-01 21:06 
GeneralRe: Ports Pin
13-Aug-01 22:50
suss13-Aug-01 22:50 
GeneralCreateProcess -> illegal instruction Pin
13-Aug-01 11:00
suss13-Aug-01 11:00 
GeneralA CWnd in a view... Re-size... Pin
13-Aug-01 11:00
suss13-Aug-01 11:00 
GeneralRe: A CWnd in a view... Re-size... Pin
Paolo Messina13-Aug-01 11:54
professionalPaolo Messina13-Aug-01 11:54 
GeneralRe: A CWnd in a view... Re-size... Pin
14-Aug-01 3:39
suss14-Aug-01 3:39 
GeneralRe: A CWnd in a view... Re-size... Pin
14-Aug-01 4:16
suss14-Aug-01 4:16 
GeneralHTTP Connection question... Pin
Cabadam13-Aug-01 10:31
Cabadam13-Aug-01 10:31 
I am using CInternetSession, CHttpConnection, and CHttpFile to get a file
from an HTTP server.

I am having a problem though determining if the initial connection succeeded
or not. If the server is 'off' then the code seems to execute despite my
'ifs' and produces an exception. If I put the statement throwing the
exception into a try-catch, it isn't caught, and crashes the program anyway.

CInternetSession net;
CHttpConnection* http = NULL;
CHttpFile* file = NULL;
http = net.GetHttpConnection("cabadam.homeip.net");
if (http == NULL)
{
status += "Failed to connect to server!\r\n";
dlg->edit_status.SetWindowText(status);
dlg->GetDlgItem(IDC_BUTTON_CONTINUE)->EnableWindow(1);
return 1;
}

file = http->OpenRequest(CHttpConnection::HTTP_VERB_GET,"version.txt");

try
{
file->SendRequest(); //THIS STATEMENT crashes the program even though it
is inside a try catch
}
catch (CInternetException pEx)
{
status += "Failed to connect to server!\r\n";
dlg->edit_status.SetWindowText(status);
dlg->GetDlgItem(IDC_BUTTON_CONTINUE)->EnableWindow(1);
return 1;
}


I have tried several different things, but I haven't been able to figure out
how to determine if it was unable to connect with the server.

Am I doing something wrong? Or is there an easier way to do this?

Thanks!

Adam
cabadam@houston.rr.com
GeneralRe: HTTP Connection question... Pin
14-Aug-01 4:46
suss14-Aug-01 4:46 
GeneralRe: HTTP Connection question... Pin
Cabadam15-Aug-01 4:47
Cabadam15-Aug-01 4:47 
GeneralClassy question Pin
otvac13-Aug-01 9:47
otvac13-Aug-01 9:47 
GeneralRe: Classy question Pin
Chris Losinger13-Aug-01 10:02
professionalChris Losinger13-Aug-01 10:02 
QuestionWhat to distribute with the final program build? Pin
13-Aug-01 9:00
suss13-Aug-01 9:00 
AnswerRe: What to distribute with the final program build? Pin
Gregg Carlstrom13-Aug-01 9:06
Gregg Carlstrom13-Aug-01 9:06 
AnswerRe: What to distribute with the final program build? Pin
Kuniva13-Aug-01 20:45
Kuniva13-Aug-01 20:45 
GeneralError in GetFieldValue() Pin
Tomas13-Aug-01 8:17
Tomas13-Aug-01 8:17 
GeneralRe: Error in GetFieldValue() Pin
Bret Faller13-Aug-01 8:33
Bret Faller13-Aug-01 8:33 
GeneralRe: Error in GetFieldValue() Pin
Tomas13-Aug-01 8:54
Tomas13-Aug-01 8:54 
GeneralRe: Error in GetFieldValue() Pin
Bret Faller13-Aug-01 9:02
Bret Faller13-Aug-01 9:02 
GeneralRe: Error in GetFieldValue() Pin
Tomas13-Aug-01 9:20
Tomas13-Aug-01 9:20 
GeneralRe: Error in GetFieldValue() Pin
Bret Faller13-Aug-01 11:04
Bret Faller13-Aug-01 11:04 
GeneralRe: Error in GetFieldValue() Pin
13-Aug-01 9:56
suss13-Aug-01 9:56 
GeneralRe: Error in GetFieldValue() Pin
Tomas13-Aug-01 12:01
Tomas13-Aug-01 12:01 
GeneralRe: Error in GetFieldValue() Pin
14-Aug-01 12:27
suss14-Aug-01 12:27 
QuestionWhat does this function do? Pin
Bret Faller13-Aug-01 8:13
Bret Faller13-Aug-01 8:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.