Registriert seit: 30. Jul 2007
156 Beiträge
Delphi 6 Personal
|
Re: temporäre dateien-Funktion deaktivieren?
20. Dez 2009, 02:39
Hier der wichtige Auszug des Codes, ist nicht so viel zu lesen, wies aussieht
....
Delphi-Quellcode:
{function cDownloadStatusCallback._AddRef: Integer;
begin
Result := 0;
end;
function cDownloadStatusCallback._Release: Integer;
begin
Result := 0;
end;
function cDownloadStatusCallback.QueryInterface(const IID: TGUID; out Obj): HResult;
begin
if(GetInterface(IID,Obj)) then
begin
Result := 0
end else
begin
Result := E_NOINTERFACE;
end;
end;
function cDownloadStatusCallback.OnStartBinding(dwReserved: DWORD; pib: IBinding): HResult;
begin
Result := S_OK;
end;
function cDownloadStatusCallback.GetPriority(out nPriority): HResult;
begin
Result := S_OK;
end;
function cDownloadStatusCallback.OnLowResource(reserved: DWORD): HResult;
begin
Result := S_OK;
end;
function cDownloadStatusCallback.OnStopBinding(hresult: HResult; szError: LPCWSTR): HResult; stdcall;
begin
Result := S_OK;
end;
function cDownloadStatusCallback.GetBindInfo(out grfBINDF: DWORD; var bindinfo: TBindInfo): HResult; stdcall;
begin
Result := S_OK;
end;
function cDownloadStatusCallback.OnDataAvailable(grfBSCF: DWORD; dwSize: DWORD; formatetc: PFormatEtc; stgmed: PStgMedium): HResult;
begin
Result := S_OK;
end;
function cDownloadStatusCallback.OnObjectAvailable(const iid: TGUID; punk: IUnknown): HResult; stdcall;
begin
Result := S_OK;
end; }
function cDownloadStatusCallback.OnProgress(ulProgress, ulProgressMax, ulStatusCode: ULONG; szStatusText: LPCWSTR): HResult;
begin
case ulStatusCode of
BINDSTATUS_FINDINGRESOURCE:
begin
Form1.Label1.Caption := 'Bild'+ floattostr(bildvar) + ': '+'Datei wurde gefunden...';
if (usercancel) then
begin
Result := E_ABORT;
exit;
end;
end;
BINDSTATUS_CONNECTING:
begin
Form1.Label1.Caption := 'Bild'+ floattostr(bildvar) + ': '+'Es wird verbunden...';
if (usercancel) then
begin
Result := E_ABORT;
exit;
end;
end;
BINDSTATUS_BEGINDOWNLOADDATA:
begin
Form1.Gauge1.Progress := 0;
Form1.Label1.Caption := 'Bild'+ floattostr(bildvar) + ': '+'Der Download wurde gestartet...';
if (UserCancel) then
begin
Result := E_ABORT;
exit;
end;
end;
BINDSTATUS_DOWNLOADINGDATA:
begin
Form1.Gauge1.Progress := MulDiv(ulProgress,100,ulProgressMax);
Form1.Label1.Caption := 'Bild'+ floattostr(bildvar) + ': '+'Datei wird heruntergeladen...';
if (UserCancel) then
begin
Result := E_ABORT; exit;
end;
end;
BINDSTATUS_ENDDOWNLOADDATA:
begin
Form1.Label1.Caption := 'Bild'+ floattostr(bildvar) + ': '+'Download wurd beendet...';
Bildvar:=Bildvar+1;
end;
end;
Application.ProcessMessages;
Result := S_OK;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
cDownStatus : cDownloadStatusCallback;
v1, v2 :string;
faktorx,faktory:real; zoom:string;
link:string;
i,x,y:integer;
begin
//.....unrelevantes Zeug hier^^.......
////1
v1:='http://********.com/Content/*****/'+*****+'/'+x1+'/'+y1+'/'+'?path='+link;
v2:='C:\'+Zahl+'.1.jpg';
cDownStatus := cDownloadStatusCallBack.Create;
try
URLDownloadToFIle(nil,PChar(v1),
PChar(v2),0,CDownStatus);
finally
cDownStatus.Free;
end;
////2 .....
////3 ..... usw
|
|
Zitat
|