用VC线程打开网页的有关问题
用VC线程打开网页的问题
我做了一个对话框程序,是用来打开网页增加我的积分的.
代码:
void CDeleteFiles_MFCDlg::OnOK()
{
DWORD dwThreadId;
HANDLE hThread;
hThread = CreateThread(NULL, 0, ProcessThread, (LPVOID)(this), 0, &dwThreadId);
}
线程如下:每隔120秒打开一次网页.
DWORD WINAPI ProcessThread(LPVOID lpParam)
{
while(1)
{
CFileFind m_find,m_find2,m_find3;
CString str,str1;
m_find.FindFile( "C:\\Documents and Settings\\tangliyan\\Cookies\\*.txt ",0);
while(m_find.FindNextFile())
{
str=m_find.GetFileName();
//AfxMessageBox(str);
str1= "C:\\Documents and Settings\\tangliyan\\Cookies\\ "+str;
remove(str1);
}
srand((unsigned) time(NULL));
int i=rand()%100+240000;//
Sleep(120000);
ShellExecute(NULL, "open ", "iexplore.exe ", "http://www.bianli365.com/site/index.php?ScoreUserID=18177 ", "C:\\Program Files\\Internet Explorer\\iexplore.exe ",SW_MINIMIZE);
Sleep(10000);
KillProgram( "IEXPLORE.exe ");
Sleep(10000);
}
ExitThread(0);
return 0;
}
程序可以运行,但是为什么程序运行很久后,积分只增加一次呢?线程里面循环运行的第一次是可以增加积分的,但后面的就不行了.
为什么为什么...谢谢~
大家来研究研究,有什么问题?
------解决方案--------------------
使用HttpOpenRequest试试,记住要指定dwFlags包含INTERNET_FLAG_RELOAD,就是说让网页访问强制从服务器访问,而不是访问本地缓存里面的网页。
但不一定可行,因为大部分付费网站都会检查每个客户连接时间有效性的。
我做了一个对话框程序,是用来打开网页增加我的积分的.
代码:
void CDeleteFiles_MFCDlg::OnOK()
{
DWORD dwThreadId;
HANDLE hThread;
hThread = CreateThread(NULL, 0, ProcessThread, (LPVOID)(this), 0, &dwThreadId);
}
线程如下:每隔120秒打开一次网页.
DWORD WINAPI ProcessThread(LPVOID lpParam)
{
while(1)
{
CFileFind m_find,m_find2,m_find3;
CString str,str1;
m_find.FindFile( "C:\\Documents and Settings\\tangliyan\\Cookies\\*.txt ",0);
while(m_find.FindNextFile())
{
str=m_find.GetFileName();
//AfxMessageBox(str);
str1= "C:\\Documents and Settings\\tangliyan\\Cookies\\ "+str;
remove(str1);
}
srand((unsigned) time(NULL));
int i=rand()%100+240000;//
Sleep(120000);
ShellExecute(NULL, "open ", "iexplore.exe ", "http://www.bianli365.com/site/index.php?ScoreUserID=18177 ", "C:\\Program Files\\Internet Explorer\\iexplore.exe ",SW_MINIMIZE);
Sleep(10000);
KillProgram( "IEXPLORE.exe ");
Sleep(10000);
}
ExitThread(0);
return 0;
}
程序可以运行,但是为什么程序运行很久后,积分只增加一次呢?线程里面循环运行的第一次是可以增加积分的,但后面的就不行了.
为什么为什么...谢谢~
大家来研究研究,有什么问题?
------解决方案--------------------
使用HttpOpenRequest试试,记住要指定dwFlags包含INTERNET_FLAG_RELOAD,就是说让网页访问强制从服务器访问,而不是访问本地缓存里面的网页。
但不一定可行,因为大部分付费网站都会检查每个客户连接时间有效性的。