我用的下载函数是:urldownloadtofile()来做的,要怎样修改才能达到目的呢?
代码附下:
int __fastcall DownLoadFile(void *dummy )
{
HRESULT hr;
HANDLE handle;
//ShowMessage("S");
hr=URLDownloadToFile(NULL,"http://im-sz.qq.com/qq2004sp1.exe","f:\\cshj\\qq2004sp1.exe",0,0);
if(hr==S_OK)
{ShellExecute(handle,NULL,"f:\\cshj\\qq2004sp1.exe",NULL,NULL,SW_SHOWNORMAL);
}
return 0;}void __fastcall TActiveReg::BitBtn1Click(TObject *Sender)
{
AnsiString S,path;
TRegistry *Registry = new TRegistry(KEY_ALL_ACCESS);
path="\\eWater";
Registry->RootKey = HKEY_CURRENT_USER;
Registry->OpenKey(path,false);
S=Registry->ReadString("version");
Registry->CloseKey();
ShowMessage("现在的注册版本信息是"+S+"\n"
+"需要下载最新版本"); int _ThreadHandle ;
int _ThreadId;
_ThreadHandle=BeginThread(NULL,0,(TThreadFunc)DownLoadFile,
(void*)this,0,_ThreadId);
}这都是在ActiveX Form下面做的
代码附下:
int __fastcall DownLoadFile(void *dummy )
{
HRESULT hr;
HANDLE handle;
//ShowMessage("S");
hr=URLDownloadToFile(NULL,"http://im-sz.qq.com/qq2004sp1.exe","f:\\cshj\\qq2004sp1.exe",0,0);
if(hr==S_OK)
{ShellExecute(handle,NULL,"f:\\cshj\\qq2004sp1.exe",NULL,NULL,SW_SHOWNORMAL);
}
return 0;}void __fastcall TActiveReg::BitBtn1Click(TObject *Sender)
{
AnsiString S,path;
TRegistry *Registry = new TRegistry(KEY_ALL_ACCESS);
path="\\eWater";
Registry->RootKey = HKEY_CURRENT_USER;
Registry->OpenKey(path,false);
S=Registry->ReadString("version");
Registry->CloseKey();
ShowMessage("现在的注册版本信息是"+S+"\n"
+"需要下载最新版本"); int _ThreadHandle ;
int _ThreadId;
_ThreadHandle=BeginThread(NULL,0,(TThreadFunc)DownLoadFile,
(void*)this,0,_ThreadId);
}这都是在ActiveX Form下面做的
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货