Home » U++ Library support » U++ MT-multithreading and servers » Stop Download
Stop Download [message #20910] |
Fri, 17 April 2009 14:43  |
MohamedMonem
Messages: 7 Registered: March 2009
|
Promising Member |
|
|
Hi All
how can I stop running download, I use this function
ExecuteRedirect(....,....,...);
I want to make button or some thing when pushed the download will be canceled !
Thanx in advance
|
|
|
|
Re: Stop Download [message #27406 is a reply to message #20912] |
Thu, 15 July 2010 17:52   |
mubeta
Messages: 77 Registered: October 2006
|
Member |
|
|
Hi all,
well, I have the same problem. Using an hidden thread my application download from remote server, via http, files or program updates.
The user don't see any progress bar, because this thread is hidden, so:
1) How I can stop the download when application is closed?
2) Otherwise, how I can show an progress bar in a different thread? (I am thinking for a small progress bar, in the application status bar).
3) Using HttpClient, how I can know if the PC is connected to Internet, for don't wait a lot of time for timeout?
thanks.
mubeta.
|
|
|
Re: Stop Download [message #27439 is a reply to message #27406] |
Sat, 17 July 2010 23:03  |
mubeta
Messages: 77 Registered: October 2006
|
Member |
|
|
Ok, I found an fast solution:
1) Using an hidden progress that take in account the "tarminate" flag:
class MyHideProgress {
protected:
int total, pos;
volatile Atomic *terminated;
public:
bool SetCanceled(int p, int t) { pos = p; total = t; return (bool)*terminated; }
operator Gate2<int, int>() { return callback(this, &MyHideProgress::SetCanceled); }
typedef MyProgress CLASSNAME;
MyHideProgress(volatile Atomic *t) { terminated = t; }
};
2) In this way the gui program can be closed quickly also with HttpClient working in background thread.
|
|
|
Goto Forum:
Current Time: Fri May 09 15:42:28 CEST 2025
Total time taken to generate the page: 0.02382 seconds
|