RSS Forums RSS
Please support our Pascal and Delphi advertiser: Programming Forums
Views: 792 | Replies: 0
Reply
Join Date: Jan 2008
Posts: 44
Reputation: Thew is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Thew's Avatar
Thew Thew is offline Offline
Light Poster

Help WinInet Caching ???

  #1  
Jan 31st, 2008
Hi,
I've got really strange problem.
I am using this function
function Download.GetInetFile(const fURL, FileName: String):boolean;
const
  BufferSize = 1024;
var
  hSession, hURL: HInternet;
  Buffer: array[1..BufferSize] of Byte;
  BufferLen: DWORD;
  f: File;
  sAppName: string;
  r:boolean;
begin
 r:=false;
 if Agent = '' then Agent := 'Server Status Controller, Matej Tomcik Production';
 sAppName := Agent;
 hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, INTERNET_FLAG_RELOAD) ;
 InternetConnect(hSession,PChar(HostName),INTERNET_DEFAULT_HTTP_PORT,PChar(UserName),PChar(Password),INTERNET_SERVICE_HTTP,INTERNET_FLAG_PASSIVE,0);
 try
  hURL := InternetOpenURL(hSession, PChar(fURL), nil, 0, INTERNET_FLAG_PRAGMA_NOCACHE, 0) ;
  try
   AssignFile(f, FileName) ;
   Rewrite(f,1) ;
   repeat
    InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen) ;
    BlockWrite(f, Buffer, BufferLen);
   until BufferLen = 0;
   CloseFile(f) ;
   r := True;
  finally
   InternetCloseHandle(hURL)
  end
 finally
  InternetCloseHandle(hSession)
 end;
 Result := r;
end;
to download a file from the internet.
To call this function, I am using a thread class. So it can be made asynchronyously with my running application.
So I compile and execute the application. After the timer ticks, I receive a message, that has this source "0". Simple. So, I have next one minute to the next timer's tick, and I rewrite the file on my website. I set it to the "1" value. But when the application shows the source, it's still the "0".
I used INTERNET_FLAG_PRAGMA_NOCACHE, but no result.

What should I do???
Any solutions?

PS: after the file is read, it's automatically deleted.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:54 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC