|
-
January 16th, 2000, 10:35 PM
#1
How to clear recent used document list from window through VB
How to clear the recent used files in windows through VB. I m opening word file at background.
thanks
Mail me : [email protected]
-
January 17th, 2000, 03:12 AM
#2
Re: How to clear recent used document list from window through VB
if you use Word 2000, you can use the Word object model.
Application.RecentFiles is the collection of the recent file list.
Iterate over all elements and call the Delete method of each element.
-
January 17th, 2000, 05:21 AM
#3
Re: How to clear recent used document list from window through VB
By doing this,it clear the recent document list in MSWord but i m not able to do that for documents in start menu.
Other option I saw in MSDN is using reference of
Declare sub shaddtorecentdocs lib "Shell32.lib" (Byval uflags as long,byval pv as string)
call shaddtorecentdocs(2,vbnullstring)
But in this case i m not able to find any such reference of "shaddtorecentdocs" in API library. if u can halp me out on this i will be thankful to u.
-
January 17th, 2000, 05:27 AM
#4
Re: How to clear recent used document list from window through VB
your declare statement is wrong.
use the following code
private Declare Sub shaddtorecentdocs Lib "Shell32.dll" Alias "SHAddToRecentDocs" (byval uflags as Long, byval pv as string)
private Sub Command1_Click()
Call shaddtorecentdocs(2, "m:\lah.htm")
End Sub
This is for ADDING documents to the recent file list...
-
January 17th, 2000, 05:45 AM
#5
Re: How to clear recent used document list from window through VB
to delete from the shell's recent file list, get the location of the folder via ShGetFolderLocation (CSIDL_RECENT) API, then delete all relevant link files in that directory using VB's kill command.
-
March 1st, 2002, 10:53 AM
#6
A bit of knowledge from Past
:-)
Have a nice day, TheGreat, wherever
Cesare Imperiali
:-)
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
March 1st, 2002, 12:26 PM
#7
Re: How to clear recent used document list from window through VB
'Make reference to Microsoft Scripting Runtime
private Sub Command1_Click()
Dim fo as Folder, fs as FileSystemObject, file1 as File
Dim FullPath as string
FullPath = "c:\windows\recent\"
set fs = CreateObject("Scripting.FileSystemObject")
set fo = fs.GetFolder(FullPath)
on error resume next
for Each file1 In fo.Files
Debug.print file1.Name
file1.Delete true
next
Err.Clear
End Sub
-
March 1st, 2002, 03:41 PM
#8
Re: How to clear recent used document list from window through VB
This code works: (taken from API-Guide with slight changes)
Const CSIDL_RECENT = &H8
Const MAX_PATH = 260
private Type SHITEMID
cb as Long
abID as Byte
End Type
private Type ITEMIDLIST
mkid as SHITEMID
End Type
private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (byval hwndOwner as Long, byval nFolder as Long, pidl as ITEMIDLIST) as Long
private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (byval pidl as Long, byval pszPath as string) as Long
private Sub Form_Load()
Dim RecentFolder as string
me.AutoRedraw = true
RecentFolder = GetSpecialfolder(CSIDL_RECENT)
set fs = CreateObject("Scripting.FileSystemObject")
set fo = fs.GetFolder(RecentFolder)
on error resume next
for Each file1 In fo.Files
file1.Delete true
next
Err.Clear
End Sub
private Function GetSpecialfolder(CSIDL as Long) as string
Dim r as Long
Dim IDL as ITEMIDLIST
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR then
Path$ = Space$(512)
r = SHGetPathFromIDList(byval IDL.mkid.cb, byval Path$)
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
----------
The @host is everywhere!
----------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|