int __fastcall DownLoadFile(void *dummy )
{
HRESULT hr;
HANDLE Handle;
AnsiString downaddress="C:\\testagain\\HY-cpucool_732-GeorgeWing.zip";
AnsiString Serverpath="http://count.skycn.com/s0ftdownlOad.php?id=3714&url=http://on165-http.skycn.net:8181/down/http://count.skycn.com/s0ftdownlOad.php?id=3714&url=http://on165-http.skycn.net:8181/down/HY-cpucool_732-GeorgeWing.zip";
hr=URLDownloadToFile(NULL,Serverpath.c_str(),downaddress.c_str(),0,0);
if(hr==S_OK)
{
ShellExecute(Handle,NULL,downaddress.c_str(),NULL,NULL,SW_SHOWNORMAL);
} return 0;}
//问题在这里,这是单独开的一个下载线程,但是好像他执行完下载,并执行以后,并没有关闭
,这个线程怎么来终止呢
void __fastcall TActiveReg::BitBtn1Click(TObject *Sender)
{
int _ThreadId;
BeginThread(NULL,0,(TThreadFunc)DownLoadFile,
(void*)this,0,_ThreadId);
}
{
HRESULT hr;
HANDLE Handle;
AnsiString downaddress="C:\\testagain\\HY-cpucool_732-GeorgeWing.zip";
AnsiString Serverpath="http://count.skycn.com/s0ftdownlOad.php?id=3714&url=http://on165-http.skycn.net:8181/down/http://count.skycn.com/s0ftdownlOad.php?id=3714&url=http://on165-http.skycn.net:8181/down/HY-cpucool_732-GeorgeWing.zip";
hr=URLDownloadToFile(NULL,Serverpath.c_str(),downaddress.c_str(),0,0);
if(hr==S_OK)
{
ShellExecute(Handle,NULL,downaddress.c_str(),NULL,NULL,SW_SHOWNORMAL);
} return 0;}
//问题在这里,这是单独开的一个下载线程,但是好像他执行完下载,并执行以后,并没有关闭
,这个线程怎么来终止呢
void __fastcall TActiveReg::BitBtn1Click(TObject *Sender)
{
int _ThreadId;
BeginThread(NULL,0,(TThreadFunc)DownLoadFile,
(void*)this,0,_ThreadId);
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货