First of all, I've never used MFC. I'm mainly an ATL developer so dont kill me for this question..
I'm needing to talk to a web server via XML from an ATL service that uses MFC and the service is calling:
CInternetSession, CHttpConnection, and CHttpFile, which I've never used.. I'm a Winsock type of guy..
The service is having some compiling issues and after looking these functions up I found the project didnt have #include "afxinet.h" and so when I add them I get a fatal error C1189: #error : WINDOWS.H already included.
How do I get around this error??
Here is the code it's using..
CInternetSession session("temp", 1);
CHttpConnection* pConn = NULL;
CHttpFile* pFile = NULL;
CString csURL = "domain.com";
CString csContext = "/dir/path";
INTERNET_PORT nPort = 443;
pConn = session.GetHttpConnection(csURL, INTERNET_FLAG_DONT_CACHE, nPort);
pFile = pConn->OpenRequest(CHttpConnection::HTTP_VERB_POST, csContext, NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE);
CString csXML = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>......";
int nLen = csXML.GetLength();
CString csRet = "";
pFile->SendRequest(NULL, 0, ((void*)(LPCSTR)csXML), nLen);
if (dwRet == HTTP_STATUS_OK)
nRead = pFile->Read(szBuff, 4095);
if (nRead <= 0)
szBuff[nRead] = 0;
csRet += szBuff;
catch (CInternetException* pEx)
//. . .