john Lee
2007-02-28 10:44:46 UTC
Dear.
The following code works well in the normal complie environment, however,
when I compile functions with _UNICODE Debugging options, the functions
does't work well.
Please let me know the reason and how to fix it.
Best Regards.
John
long CHTTPConnect::SendReceive_Get(LPCTSTR pszOrg, CString& pszDest)
{
CInternetSession* session = NULL;
CInternetFile* file = NULL;
CString buf = "";
if (m_nProxyEnabled)
{
session = new CInternetSession(_T("CQEK"), 1, INTERNET_OPEN_TYPE_PROXY,
m_szProxyName, NULL, 0);
}
else
{
session = new CInternetSession(_T("CQEK"), 1,
INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
}
buf = pszOrg;
pszDest = "";
try
{
file = (CInternetFile*)session->OpenURL(buf, 1, INTERNET_FLAG_DONT_CACHE |
INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_RELOAD);
}
catch (CInternetException* file2)
{
TCHAR sz[1024];
file2->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
file2->Delete();
c_CommonInfo.Error_Window(IDS_10001);
return FALSE;
}
if (file)
{
file->SetReadBufferSize(30000);
while (1)
{
BOOL bRet = file->ReadString(buf);
pszDest += buf;
if (!bRet)
{
break;
}
}
file->Close();
}
if (file)
{
delete file;
}
if (session)
{
delete session;
}
return TRUE;
}
The following code works well in the normal complie environment, however,
when I compile functions with _UNICODE Debugging options, the functions
does't work well.
Please let me know the reason and how to fix it.
Best Regards.
John
long CHTTPConnect::SendReceive_Get(LPCTSTR pszOrg, CString& pszDest)
{
CInternetSession* session = NULL;
CInternetFile* file = NULL;
CString buf = "";
if (m_nProxyEnabled)
{
session = new CInternetSession(_T("CQEK"), 1, INTERNET_OPEN_TYPE_PROXY,
m_szProxyName, NULL, 0);
}
else
{
session = new CInternetSession(_T("CQEK"), 1,
INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
}
buf = pszOrg;
pszDest = "";
try
{
file = (CInternetFile*)session->OpenURL(buf, 1, INTERNET_FLAG_DONT_CACHE |
INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_RELOAD);
}
catch (CInternetException* file2)
{
TCHAR sz[1024];
file2->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
file2->Delete();
c_CommonInfo.Error_Window(IDS_10001);
return FALSE;
}
if (file)
{
file->SetReadBufferSize(30000);
while (1)
{
BOOL bRet = file->ReadString(buf);
pszDest += buf;
if (!bRet)
{
break;
}
}
file->Close();
}
if (file)
{
delete file;
}
if (session)
{
delete session;
}
return TRUE;
}