#include "windows.h"
#include "Wininet.h"
#pragma comment (lib,"Wininet.lib")void Action();int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{ ////////////////////////////////////////////////////////////////////
Action();
return 0;
}
void Action()
{
HINTERNET hInternet=NULL;
while(hInternet==NULL)
{
hInternet = InternetOpen("Robot",INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if(hInternet==NULL) Sleep(5000);
}

char* URL="http://localhost/ip/get.php"; HINTERNET hHttp = NULL;
for(;;)
{
while(hHttp==NULL)
{
hHttp = InternetOpenUrl(hInternet,URL,NULL, -1L,INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE, 0);
if(hHttp==NULL) Sleep(5000);
} //char* buffer;
//buffer=new char;
//unsigned long* len=0;
//if(isLocal) 
//{
// InternetReadFile(hHttp,buffer,1024,len);
// delete buffer;
// buffer=NULL;
//}
CloseHandle(hHttp);//会不会是这里?貌似又不像
hHttp=NULL;
}
}
不知道为什么,用着内存占用一直不短地上涨,一般是+4K或这8K,真的郁闷。
我还写过一个及其简单的SDK程序(找不到了),代码基本也差不多(还要简单),就是不会有上涨的现象!我试着将代码最小化,但是一样的结果!
期待高手!