官方離線升級包下載地址是:http://www.eset.com.cn/html/download/offline.shtml
用vc寫了段代碼,自動下載更新包並解壓至指定目錄,然後指定更新目錄為那個目錄就好了,建一個計劃任務,每天更新一次就實現自動更新了。
以下是簡單的代碼:
// download.cpp : 定義控制台應用程序的入口點。
//code By:Neeao
//http://Neeao.com
#include "stdafx.h"
#include <windows.h>
#include <urlmon.h>
#pragma comment(lib, "urlmon.lib")
int _tmain(int argc, _TCHAR* argv[])
{
HRESULT hr=URLDownloadToFile(NULL,"http://down1.eset.com.cn/eset/offlinev2.rar","d:\\offlinev2.rar",0,NULL);
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "C:\\Program Files\\WinRAR\\RAR.exe"; //調用rar
ShExecInfo.lpParameters = "e d:\\offlinev2.rar -o+ D:\\offlinev2\\"; //執行的命令
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);//等解壓縮完畢繼續往下執行
return 0;
}
註: 本文轉載自網路 非原創
轉載自 Neeao'sBlog 原文