笨方法刷博客_C实现

 

使用一个笨方法去完成****博客的阅读数增加,话不多说上代码

#include <windows.h>
#include <tchar.h>
#include <assert.h>
 
const TCHAR szOpen[] = _T("open");
const TCHAR szAddress1[] = _T("https://blog.****.net/SherlockHolmess/article/details/87875558");

int main()
{
    while(1)
    {
        HINSTANCE hRslt1 = ShellExecute(NULL, szOperation,	szAddress1, NULL, NULL, SW_SHOWNORMAL);
	assert(hRslt1 > (HINSTANCE)HINSTANCE_ERROR);
        Sleep(60000);                                    //延时60000ms
	system("TASKKILL /f /im chrome.exe");            //关闭chrome.exe进程树
    }
    return 0;
}

实现方法是通过默认浏览器去完成,使用系统的API函数完成访问网站和关闭chrome.exe进程树。

笨方法刷博客_C实现

笨方法刷博客_C实现

可以通过改动的添加      去完成多个网址的访问       这里就自己添加改动程序啦。

还可以使用系统的ie浏览器  此方法类似于:win+r   然后输入iexplore  然后输入网址

//只需函数参数改为
ShellExecute(NULL, _T("open"), _T("iexplore"), _T("https://blog.****.net/SherlockHolmess/article/details/87893055"), NULL, SW_SHOW);

system("TASKKILL /f /im iexplore.exe");

 笨方法刷博客_C实现

//或者使用Firefox等其他的浏览器
ShellExecute(NULL, _T("open"), _T("firefox"), _T("https://blog.****.net/SherlockHolmess/article/details/87893055"), NULL, SW_SHOW);

system("TASKKILL /f /im firefox.exe");

 笨方法刷博客_C实现

下次将会发布通过http协议发送数据的方式。