BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

FindFile - can not find files in the temporary internet dire

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
edo
Guest





PostPosted: Sun Nov 16, 2003 1:45 pm    Post subject: FindFile - can not find files in the temporary internet dire Reply with quote



hi,

i'm trying to find, and read files that had been created while surfing the
WWW.
i can see those files in the Windows-Eplorer, but the function :
FindFirst('..Temporary Internet*', faAnyFile , searchRec)
fails....


BTW,
is there any official way to get the Temporary Internet directory, or at
least the most common used directory, by the most popular browsers i.e.
MS-IE, Netscape, OPERA?
i found in the registry:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet
SettingsCachePaths
StringValue - Directory
is it good for MS-IE only?

thanks in advance!
edo.



Back to top
Larry Siemer
Guest





PostPosted: Sun Nov 16, 2003 3:45 pm    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote



Try using the routines in the unit JclSysInfo from the JEDI-JCL
project, they use the official method.

http://sourceforge.net/projects/jcl/


"edo" <ewilde> wrote

Quote:
BTW,
is there any official way to get the Temporary Internet directory,
or at
least the most common used directory, by the most popular browsers
i.e.
MS-IE, Netscape, OPERA?





Back to top
Dennis Passmore
Guest





PostPosted: Sun Nov 16, 2003 5:50 pm    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote



Here is a code sample to get you started:

unit InternetCacheListu;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses
WinInet;

{$R *.dfm}

(*
Here is an example how it could be done. I don't want to delete my cache, so
it only outputs the url to a TMemo Wink To delete the entries
DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName) should work.
*)

procedure TForm1.Button1Click(Sender: TObject);
var
lpEntryInfo: PInternetCacheEntryInfo;
hCacheDir: LongWord (*Handle*);
dwEntrySize, dwLastError: LongWord;
begin
//Get size of first entry in dwEntrySize
dwEntrySize := 0;
FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);
//Create structure that can hold entry
GetMem(lpEntryInfo, dwEntrySize);
//Get first cache entry and handle to retrieve next entry, output url
hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
if hCacheDir <> 0 then
Memo1.Lines.Add(string(lpEntryInfo^.lpszSourceUrlName));
//free structure
FreeMem(lpEntryInfo);

//retrieve all subsequent entries
repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^),
dwEntrySize);
dwLastError := GetLastError();
if GetLastError = ERROR_INSUFFICIENT_BUFFER then begin
GetMem(lpEntryInfo, dwEntrySize);
if FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize) then
Memo1.Lines.Add(string(lpEntryInfo^.lpszSourceUrlName));
FreeMem(lpEntryInfo);
end;
until dwLastError = ERROR_NO_MORE_ITEMS;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Button1Click(nil);
end;

end.


Dennis Passmore
Ultimate Software, Inc.
Back to top
Rob Kennedy
Guest





PostPosted: Sun Nov 16, 2003 7:38 pm    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote

edo wrote:
Quote:
i'm trying to find, and read files that had been created while surfing the
WWW.
i can see those files in the Windows-Eplorer, but the function :
FindFirst('..Temporary Internet*', faAnyFile , searchRec)
fails....

I doubt you have any directory by that name on your computer, especially
not as a sibling to your program's current directory. The file system in
the Temporary Internet Files directory does not match what Explorer
shows you. The folder actually contains a handful of randomly named
subdirectories, and it's those subdirectories that contain the cached files.

Quote:
BTW,
is there any official way to get the Temporary Internet directory, or at
least the most common used directory, by the most popular browsers i.e.
MS-IE, Netscape, OPERA?
i found in the registry:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet
SettingsCachePaths
StringValue - Directory
is it good for MS-IE only?

Each browser uses its own cache. Internet Explorer and its related
programs use the Temporary Internet Files folder, which you can fetch
via the ShGetFolderPath API function. Netscape, Mozilla, and Opera each
use their own directories, which are not available through any Microsoft
API. Netscape and Mozilla store the cached files with random names and
access them using a map file.

--
Rob


Back to top
René Allan Larsen
Guest





PostPosted: Sun Nov 16, 2003 8:12 pm    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote

In article <3fb77f5d (AT) newsgroups (DOT) borland.com>, Edo wrote:
Quote:

hi,

i'm trying to find, and read files that had been created while surfing the
WWW.
i can see those files in the Windows-Eplorer, but the function :
FindFirst('..Temporary Internet*', faAnyFile , searchRec)
fails....

On my PC (Windows98), the directory is named "Temporary Internet Files". In
that directory is the directory "Content.IE5". In *that* directory are
*four* directories named "81QJCLMJ", "496BC9EF", "C1QFS5MR" and "SLA7G16B"
(on my other PC the last four directories have other names). It is a mix of
the files in the last four directories, that combines to the files that has
been created while surfing the WWW.

The problem is the files named "desktop.ini" in all of those directories.
They specify how Windows should show the content of directories (and this is
propably the reason for your problems). If you rename this file, the
directories act like normal directories.

Regards, René


Back to top
edo
Guest





PostPosted: Mon Nov 17, 2003 9:16 am    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote

Thank you very very much!!

i'm trying to learn a lesson from this experience.

i guess all the units in BorlandDelphi5SourceRtlWin, contain "links" to
procedures in microsoft's .dll files.
the most common unit is windows.pas which load libraries like :
kernel32,comctl32 etc...
sometimes there are a kind of "completions", like the unit TLHelp32.pas,
which has a few more "links" to the kernel32.dll (i spent years to find it a
few months ago....but at least i had documention in the Win32 Developer's
Reference)

well, this time, i can not even find any doncumention, about those
procedures in wininet.dll.
(i'm still struggling through guessing the proper value for
lpszUrlSearchPattern, in order to find only files like, for example :
'*cnn*.html')

can you explain the common sence of what procedures of any .dll files exist
where in the .pas files, and where should i expect to find documentations
for everything?

thanks again,
edo.

"edo" <ewilde> wrote

Quote:
hi,

i'm trying to find, and read files that had been created while surfing the
WWW.
i can see those files in the Windows-Eplorer, but the function :
FindFirst('..Temporary Internet*', faAnyFile , searchRec)
fails....


BTW,
is there any official way to get the Temporary Internet directory, or at
least the most common used directory, by the most popular browsers i.e.
MS-IE, Netscape, OPERA?
i found in the registry:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet
SettingsCachePaths
StringValue - Directory
is it good for MS-IE only?

thanks in advance!
edo.






Back to top
edo
Guest





PostPosted: Mon Nov 17, 2003 9:16 am    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote

Thank you very very much!!

i'm trying to learn a lesson from this experience.

i guess all the units in BorlandDelphi5SourceRtlWin, contain "links" to
procedures in microsoft's .dll files.
the most common unit is windows.pas which load libraries like :
kernel32,comctl32 etc...
sometimes there are a kind of "completions", like the unit TLHelp32.pas,
which has a few more "links" to the kernel32.dll (i spent years to find it a
few months ago....but at least i had documention in the Win32 Developer's
Reference)

well, this time, i can not even find any doncumention, about those
procedures in wininet.dll.
(i'm still struggling through guessing the proper value for
lpszUrlSearchPattern, in order to find only files like, for example :
'*cnn*.html')

can you explain the common sence of what procedures of any .dll files exist
where in the .pas files, and where should i expect to find documentations
for everything?

thanks again,
edo.

<Dennis Passmore> wrote

Quote:
Here is a code sample to get you started:

unit InternetCacheListu;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses
WinInet;

{$R *.dfm}

(*
Here is an example how it could be done. I don't want to delete my cache,
so
it only outputs the url to a TMemo Wink To delete the entries
DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName) should work.
*)

procedure TForm1.Button1Click(Sender: TObject);
var
lpEntryInfo: PInternetCacheEntryInfo;
hCacheDir: LongWord (*Handle*);
dwEntrySize, dwLastError: LongWord;
begin
//Get size of first entry in dwEntrySize
dwEntrySize := 0;
FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);
//Create structure that can hold entry
GetMem(lpEntryInfo, dwEntrySize);
//Get first cache entry and handle to retrieve next entry, output url
hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
if hCacheDir <> 0 then
Memo1.Lines.Add(string(lpEntryInfo^.lpszSourceUrlName));
//free structure
FreeMem(lpEntryInfo);

//retrieve all subsequent entries
repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^),
dwEntrySize);
dwLastError := GetLastError();
if GetLastError = ERROR_INSUFFICIENT_BUFFER then begin
GetMem(lpEntryInfo, dwEntrySize);
if FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize) then
Memo1.Lines.Add(string(lpEntryInfo^.lpszSourceUrlName));
FreeMem(lpEntryInfo);
end;
until dwLastError = ERROR_NO_MORE_ITEMS;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Button1Click(nil);
end;

end.


Dennis Passmore
Ultimate Software, Inc.



Back to top
Chris Morgan
Guest





PostPosted: Mon Nov 17, 2003 1:23 pm    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote

Quote:
can you explain the common sence of what procedures of any .dll
files exist
where in the .pas files, and where should i expect to find
documentations
for everything?

All the most common Windows API are translated for you by Borland,
however,
Borland do not document the Windows APIs. You need to download the
complete
up-to-date Windows API help from microsoft. Can't remember the URL,
but it should be easy enough to find.
The more esoteric Windows APIs, and those which may not be available
on
all versions of Windows are being transalted for Delphi by the JEDI
project
(I think), which you should be able to find numerous references to in
these newsgroups or on Google.

Good luck!

Chris



Back to top
Rob Kennedy
Guest





PostPosted: Mon Nov 17, 2003 5:12 pm    Post subject: Re: FindFile - can not find files in the temporary internet Reply with quote

edo wrote:
Quote:
i guess all the units in BorlandDelphi5SourceRtlWin, contain "links" to
procedures in microsoft's .dll files.
the most common unit is windows.pas which load libraries like :
kernel32,comctl32 etc...
sometimes there are a kind of "completions", like the unit TLHelp32.pas,
which has a few more "links" to the kernel32.dll

That's because the Toolhelp functions aren't available in all versions
of Windows. Importing them requires special code, which wouldn't have
been appropriate to include in Windows.pas. Also, putting the Toolhelp
functions in a special unit serves as a reminder to the programmer that
those platform-specific functions are being used. Similar functions for
the non-Toolhelp Windows versions are in PSAPI.pas.

Quote:
can you explain the common sence of what procedures of any .dll files exist
where in the .pas files,

As you noticed, most of them are in Windows.pas. Shell-related functions
are in ShellAPI or ShlObj. COM-related functions are usually in ActiveX
or ComObj. If you cannot find a function, do a text search. If that
still doesn't yield any results, then Borland might not have declared it
in any of Delphi's units. You can either declare it yourself, or you can
get a copy of someone else's translations of the relevant Microsoft SDK
header files. (The names of the header files and import units are a
strong indication of which Delphi unit you should use.)

Quote:
and where should i expect to find documentations
for everything?

If the function is declared somewhere in the SourceRTLWin directory,
then you should expect to find it documented at
http://msdn.microsoft.com. Add that site to your bookmarks or favorites
immediately. You won't be sorry.

--
Rob


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.