1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
char* msg1=const_cast<char*>("Connecting To Server....");
SendMessageA(ClientArea, AM_CLIENTWINDOW_STARTTEXT_CHANGE, 500, (LPARAM)(LPCTSTR)msg1);
std::string defstr;
std::stringstream vstrm;
std::string vstr;
DWORD_PTR context=2;
HINTERNET c=InternetOpen("App", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
if(c==NULL)
{
ErrorExit("HINTERNET c");
return 0;
}
InternetSetStatusCallback(c, (INTERNET_STATUS_CALLBACK)iNetStat);
HINTERNET ws=InternetConnectA(c,"dmailserver01.site40.net",INTERNET_DEFAULT_HTTP_PORT,NULL,NULL,INTERNET_SERVICE_HTTP,0,0);
//HINTERNET ws=InternetOpenUrl(c, "dmailserver01.site40.net", NULL, 0, INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_NO_CACHE_WRITE, context);
if(ws==NULL)
{
ErrorExit("HINTERNET ws");
return 0;
}
std::string rtypestr="POST";
std::string versionstr="HTTP/1.1";
const char* fn="/connect.php";
const char* rtype=rtypestr.c_str();
const char* version=versionstr.c_str();
PCTSTR accept[]={"text/html", "application/xhtml+xml", "application/xml;q=0.9", "image/webp", NULL};
HINTERNET h=HttpOpenRequestA(ws, rtype, fn, version, *accept, NULL, INTERNET_FLAG_CACHE_IF_NET_FAIL, context);
if(h==NULL)
{
ErrorExit("HINTERNET h");
return 0;
}
BOOL res=HttpSendRequestA(h, NULL, 0, NULL, 0);
if(res==false)
{
ErrorExit("res");
}
//InternetCloseHandle(h);
//InternetCloseHandle(ws);
//InternetCloseHandle(c);
break; //see below
|