It can be done with the Shell by enumerating items from "shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}" like I did in this thread
To remove an item, it is the menu command "unpinfromhome", although, from my tests (Windows 10 21H1), for files I have to get the localized description ("Supprimer de l'accès rapide" on my french OS from GetMenuString) then the ID with GetMenuItemInfo and MIIM_ID, then ici.lpVerb = (IntPtr)(ID - 1) for InvokeCommand
How to get recent docs list and delete some of them using windows api?
Steins
41
Reputation points
I'm trying to write a script to get windows recent docs and try delete some of them using rust.
- Be aware that i can add one or clear all using winsafe::SHAddToRecentDocs.
- Found that recent files will be stored at C:\Users\xx\AppData\Roaming\Microsoft\Windows\Recent, particularly f01b4d95cf55d32a.automaticDestinations-ms.
- Check the automaticDestinations-ms file with winhex, did found some recent access path.
- Since windows allows us right click on recent files and 'remove from quick access', there supposed to be an api do this job, failed to found it.
- Keeping search and found some says they been saved at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs, checked and found not easy to understand them.
So here's my question:
- How to get recent files list? Like the file explorer did.
- How to remove some items from it? Like the button 'remove from quick access' did.
- How to disable 'Show recently used files in quick access' or 'show frequently used folders in quick access'?
Accepted answer
-
Castorix31 86,396 Reputation points
Nov 14, 2022, 4:46 PM