Click here to Skip to main content
15,886,067 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CStrings Pin
#realJSOP17-Oct-01 0:26
mve#realJSOP17-Oct-01 0:26 
GeneralMaking things pretty by returning BSTR's (ATLCOM) Pin
Tim Rymer16-Oct-01 10:02
Tim Rymer16-Oct-01 10:02 
GeneralRe: Making things pretty by returning BSTR's (ATLCOM) Pin
Carlos Antollini16-Oct-01 10:27
Carlos Antollini16-Oct-01 10:27 
GeneralRe: Making things pretty by returning BSTR's (ATLCOM) Pin
Tim Rymer16-Oct-01 10:48
Tim Rymer16-Oct-01 10:48 
GeneralRe: Making things pretty by returning BSTR's (ATLCOM) Pin
Carlos Antollini16-Oct-01 10:59
Carlos Antollini16-Oct-01 10:59 
GeneralRe: Making things pretty by returning BSTR's (ATLCOM) Pin
Tim Rymer16-Oct-01 11:25
Tim Rymer16-Oct-01 11:25 
GeneralRe: Making things pretty by returning BSTR's (ATLCOM) Pin
Christian Graus16-Oct-01 12:28
protectorChristian Graus16-Oct-01 12:28 
GeneralDetecting slow Internet connection Pin
José Luis Sogorb16-Oct-01 9:02
José Luis Sogorb16-Oct-01 9:02 
How could I abort an http download if the connection is too slow?
For instance, if I have this code using MFC_Tear_Sample

void getHttp()
{
CString pszURL = "http://weather.noaa.gov/weather/current/";
CString uneURL;
BOOL bStripMode = FALSE;
DWORD dwAccessType = PRE_CONFIG_INTERNET_ACCESS;
DWORD dwHttpRequestFlags =
INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_NO_AUTO_REDIRECT | INTERNET_FLAG_RELOAD;

const TCHAR szHeaders[] =
_T("Accept: text/*\r\nUser-Agent: MFC_Tear_Sample\r\n");

FILE *fp1;
int nRetCode = 0;

CTearSession session(_T("TEAR - MFC Sample App"), dwAccessType);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;

uneURL=pszURL+selEstacion+".html";
try
{
// check to see if this is a reasonable URL
CString strServerName;
CString strObject;
INTERNET_PORT nPort;
DWORD dwServiceType;

if (!AfxParseURL(uneURL, dwServiceType, strServerName, strObject, nPort) ||
dwServiceType != INTERNET_SERVICE_HTTP)
{
MessageBox(0,"Error: Solo se pueden usar direcciones que comiencen con http://","Error en URL",MB_OK);
ThrowTearException(1);
}
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,
strObject, NULL, 1, NULL, NULL, dwHttpRequestFlags);
pFile->AddRequestHeaders(szHeaders);
pFile->SendRequest();

if((fp1=fopen("temp.htm","wb"))!=NULL)
{
TCHAR sz[1024];
while (pFile->ReadString(sz, 1023))
{
fputs(sz,fp1);
}
httpLeido =TRUE;
}
else AfxMessageBox("No se han podido encontrar, en estos momentos, datos sobre dicha estación");
fclose(fp1);
}
catch (CInternetException* pEx)
{
// catch errors from WinINet
CString szErr;
szErr.Format("Internet Exception Error %d", pEx->m_dwError);
MessageBox(0,szErr,"ERROR",MB_OK);
pEx->Delete();
}
catch (CTearException* pEx)
{
// catch things wrong with parameters, etc
nRetCode = pEx->m_nErrorCode;
TRACE1("Error: Exiting with CTearException(%d)\n", nRetCode);
pEx->Delete();
}

if (pFile != NULL)
{
pFile->Close();
delete pFile;
}

if (pServer != NULL)
{
pServer->Close();
delete pServer;
}
session.Close();
}
GeneralCAB file doesn't open in WIn95/NT4 Pin
16-Oct-01 6:02
suss16-Oct-01 6:02 
GeneralStreaming into CStrings.. Pin
Bernhard16-Oct-01 5:04
Bernhard16-Oct-01 5:04 
GeneralRe: Streaming into CStrings.. Pin
Joaquín M López Muñoz16-Oct-01 9:35
Joaquín M López Muñoz16-Oct-01 9:35 
GeneralVisual Studio crashes on Windows 2000.. Pin
Kant16-Oct-01 4:53
Kant16-Oct-01 4:53 
GeneralRe: ,Formatting c string and std strings Pin
Jon Salter16-Oct-01 4:51
Jon Salter16-Oct-01 4:51 
GeneralRe: ,Formatting c string and std strings Pin
Bernhard16-Oct-01 4:53
Bernhard16-Oct-01 4:53 
GeneralRe: ,Formatting c string and std strings Pin
Jon Salter16-Oct-01 4:55
Jon Salter16-Oct-01 4:55 
GeneralRe: ,Formatting c string and std strings Pin
Bernhard16-Oct-01 4:59
Bernhard16-Oct-01 4:59 
Generalbasic question Pin
16-Oct-01 4:28
suss16-Oct-01 4:28 
GeneralRe: basic question Pin
Rob Caldecott16-Oct-01 4:44
Rob Caldecott16-Oct-01 4:44 
GeneralRe: basic question Pin
16-Oct-01 4:57
suss16-Oct-01 4:57 
GeneralRe: basic question Pin
Alvaro Mendez16-Oct-01 6:24
Alvaro Mendez16-Oct-01 6:24 
GeneralRe: One rule.... Pin
Masaaki Onishi16-Oct-01 6:40
Masaaki Onishi16-Oct-01 6:40 
GeneralRe: basic question Pin
peterchen16-Oct-01 7:30
peterchen16-Oct-01 7:30 
GeneralRe: basic question Pin
16-Oct-01 22:33
suss16-Oct-01 22:33 
GeneralRe: basic question Pin
Xian16-Oct-01 8:48
Xian16-Oct-01 8:48 
GeneralTalking to Parallel Port Pin
Russell Morris16-Oct-01 3:53
Russell Morris16-Oct-01 3:53 

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.