'' then
begin
URLtoDL :=
GetTextFromURL('http://get.videolan.org:81/vlc/last/win32/' +
FileNameToDL,'The document has moved '' then
begin
Updater.Progressbar1.Position := 0;
download:= THTTPDownload.Create(URLtoDL, FileNameToDL);
download.Resume;
Updater.ShowModal;
download.free;
end;
end;
end;
if you want more simple, use the great benibela's internet tools
(GPL)
here : http://benibela.de/sources_en.html#internettools
Friendly, J.P
----------------------------------------------------------------------
mesiarm · 2013-07-14 09:37
Jurrasic Pork thank you very much for your patience with me and for
your advices and BeniBela also thank you And please look at this
image - it ´s preview of my project -
http://img199.imageshack.us/img199/5716/ddyb.png Acessing to form ....
in main form updater is global variable ... and I have also changed
Owner from nil to Application and Showmodal to Show and deleted
updater.Free line but it didnt worked. Now I have added line : Code:
[Select]if assigned (self) then showmessage ('yes in form activate')
else showmessage ('no in form activate'); to Tupdater.Formactivate
and it returns yes... so in formactivate and other form methods it
works because I have changed updater to self.... But in thread I have
to call it as updater because thread is other class and there it
returns no (if I call Code: [Select]if assigned (updater) then
showmessage ('yes in thread') else showmessage ('no in thread'); and
even Code: [Select] if fupdater = nil then showmessage ('yes nil')
else showmessage ('no nil'); returns yes nil in thread) Please help
me ...
----------------------------------------------------------------------
Jurassic Pork · 2013-07-14 15:11
hello mesiarm,
the best solution would be to put your whole project in attachment (if
it is possible) to see what is wrong.
Friendly, J.P
----------------------------------------------------------------------
mesiarm · 2013-07-28 12:56
Sorry I wasn´t online for long time but now I have created demo
project of my problem because I wanted to know where s the problem -
here it is : http://uploadir.com/uploads/l79yb6ji/downloads/new
----------------------------------------------------------------------
Jurassic Pork · 2013-07-28 15:46
Hello Mesiarm,
i don't know why you don't work with Form2 all the time and why you
use fupdater variable.
With those changes it seems that your project run :
1 - remove unit2 from the uses at the beginning of the unit1.
Code: [Select]interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls;
2 - replace your code by this code after implementation :
Code: [Select]implementation
uses Unit2; // here is the trick
{$R *.lfm}
{ TForm1 }
procedure TForm1.btnClick(Sender: TObject);
begin
Form2.showmodal;
end;
end.
3 - in the unit2 replace all the occurences of Fupdater by Form2.
Friendly, J.P
----------------------------------------------------------------------
mesiarm · 2013-07-30 18:48
Yes than you... now it works.... and please can you explain me what´s
difference in using in interface and implementation part? Idon´t
understand that....
----------------------------------------------------------------------
Jurassic Pork · 2013-07-30 22:54
for example read this about circular unit references
----------------------------------------------------------------------
mesiarm · 2013-08-01 21:44
ok thanks I have read it. now I want to implement cancel button and
I have downloadthread.terminate command in cancelonclick, but it won´t
cancel download... I have read that terminate only send instruction to
terminate and i didn´t found way to force terminate thread ...so i
wanted to add while not terminated loop.... debbugging I have found
that during download is still running this command: Code:
[Select]HTTPGetResult:=http.HTTPMethod('GET', fURL); so i have added
Code: [Select]while not terminated do
HTTPGetResult:=http.HTTPMethod('GET', fURL); It didn´t worked... I
wanted to use something like Application.ProcessMessages and since I
can´t use this command inside thread I tried this code which i had
found
Code: [Select] if MsgWaitForMultipleObjects(0, nil, FALSE, 10,
QS_ALLINPUT) = WAIT_OBJECT_0 then
begin
while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end; without success. What can I do with it?
----------------------------------------------------------------------
mesiarm · 2013-09-19 20:45
Hm I found it, with http.Abort.... but Jurrasic Pork you have earlier
gave me function GetTextFromURL and it worked till now...please look
at it... now I don´t know, why it stopped working and although it
with redirect with code you have said to me, when it connect to
server, it will return 302 Moved Temporarily