I made this program that downloads a small 5kb html file from the internet, reads from it and deletes it.
when i give it to other people to test the application on their computer, some of them (not all of them... on my computer it works perfectly fine) get an I/O error...(that they dont have the right access to the file blah blah blah).
in my program i use a file download from the internet :
"
function GetInetFile (const fileURL, FileName: String): boolean;
const
BufferSize = 1024;
var
hSession, hURL: HInternet;
Buffer: array[1..BufferSize] of Byte;
BufferLen: DWORD;
f: File;
sAppName: string;
begin
result := false;
sAppName := ExtractFileName(Application.ExeName) ;
hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0) ;
try
hURL := InternetOpenURL(hSession, PChar(fileURL), nil, 0, 0, 0) ;
try
AssignFile(f, FileName) ;
Rewrite(f,1) ;
repeat
InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen) ;
BlockWrite(f, Buffer, BufferLen)
until BufferLen = 0;
CloseFile(f) ;
result := True;
finally
InternetCloseHandle(hURL)
end
finally
InternetCloseHandle(hSession)
end;
GetInetFile := result ;
end;
"
and after the file is downloaded i use a regular AssignFile, Reset and Close commands to read from it...
How can I fix this problem?
Anyone familiar with this kind of error?
Help would be grately appreciated!!
Thanks a bunch in advance!
when i give it to other people to test the application on their computer, some of them (not all of them... on my computer it works perfectly fine) get an I/O error...(that they dont have the right access to the file blah blah blah).
in my program i use a file download from the internet :
"
function GetInetFile (const fileURL, FileName: String): boolean;
const
BufferSize = 1024;
var
hSession, hURL: HInternet;
Buffer: array[1..BufferSize] of Byte;
BufferLen: DWORD;
f: File;
sAppName: string;
begin
result := false;
sAppName := ExtractFileName(Application.ExeName) ;
hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0) ;
try
hURL := InternetOpenURL(hSession, PChar(fileURL), nil, 0, 0, 0) ;
try
AssignFile(f, FileName) ;
Rewrite(f,1) ;
repeat
InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen) ;
BlockWrite(f, Buffer, BufferLen)
until BufferLen = 0;
CloseFile(f) ;
result := True;
finally
InternetCloseHandle(hURL)
end
finally
InternetCloseHandle(hSession)
end;
GetInetFile := result ;
end;
"
and after the file is downloaded i use a regular AssignFile, Reset and Close commands to read from it...
How can I fix this problem?
Anyone familiar with this kind of error?
Help would be grately appreciated!!
Thanks a bunch in advance!