标签:
QQ昵称控制软件更新的代码,用起来很方便。
#include <WINDOWS.H>
#include <STDIO.H>
#pragma comment(lib, "Wininet.lib")
#include <wininet.h>
int main()
{
HINTERNET hInternet=NULL;
HINTERNET hConnect=NULL;
char szText[512]={0};
char *szAccept="Accept: */*\r\n\r\n";
char szUrl[1024] ;
strcpy(szUrl,"http://users.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?uins=123456"); //你的QQ
DWORD dwReadLen=0;
__try
{
hInternet=InternetOpen("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",0,NULL,NULL,0);
if(!hInternet)
__leave;
hConnect=InternetOpenUrl(hInternet,szUrl,szAccept,strlen(szAccept),INTERNET_FLAG_DONT_CACHE|INTERNET_FLAG_PRAGMA_NOCACHE|INTERNET_FLAG_RELOAD,0);
if(!hConnect)
__leave;
InternetReadFile(hConnect,szText,512,&dwReadLen);
}
__finally
{
if(hInternet)
InternetCloseHandle(hInternet);
if(hConnect)
InternetCloseHandle(hConnect);
}
char *start=strstr(szText,"昵称"); //如果你的昵称不等于这个昵称 提示过期
if(!start)
{
{
MessageBox(NULL,"当前版本已过期","",NULL);
ShellExecute(NULL,"open","http://www.baidu.com/gengxin.asp",NULL,NULL,SW_SHOW); //跳转更新
}
ExitProcess(0);
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/makebug/p/5357120.html