2

Is there a way to clean the most recently started applications from the Windows 7 start menu programmatically?

I'm looking for some registry entries and/or files to delete so the corresponding items in the Winodws 7 start menu are removed.

Bart
  • 19,692
  • 7
  • 68
  • 77
Boris
  • 71
  • 1
  • 3
  • 8

3 Answers3

2

SHAddToRecentDocs(SHARD_PIDL,NULL) is the documented way to clear the recent documents, not messing in the registry like surya suggests.

Since your question includes the word "applications" I'm assuming that you are actually mean the list of applications, and there is no real way to modify that programmatically since that list "belongs" to the user.

If you want to go the undocumented hacky route you can use get a IContextMenu for the specific .lnk and call the "Remove from this list" command.

On XP the start menu application usage is stored in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist{75048700-EF1F-11D0-9888-006097DEACF9} but explorer will cache those entries so you can't just delete the key without killing explorer first.

Anders
  • 97,548
  • 12
  • 110
  • 164
  • Hi! I cleaned most recently started applications items from the Windows 7 Start Menu cleaning the UserAssist Key in the Registry. Unfortunatelly I had to restart the Explorer.exe to refresh the Explorer.exe cache. May there be a better way to refresh the cache of exeplorer.exe? – Boris Jan 14 '11 at 14:59
0

Now this is the solution for my question:

I Cleaned the values under the Registry Keys

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{CEBFF5CD-ACE2-4F4F-9178-9926F41749EA}\Count
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{F4E57C4B-2036-45F0-A9AB-443BCFE33D9F}\Count

Then I executed the following PInvoke to refresh the cache of the Explorer.exe:

C#:

using System.Runtime.InteropServices;
[DllImport("shell32.dll")]
static extern void SHChangeNotify(int wEventId, int uFlags, IntPtr dwItem1, IntPtr wItem2);

private const int SHCNE_ASSOCCHANGED = 0x08000000;
private const int SHCNF_IDLIST = 0x0000;

private void ClearCache()
{
 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
}

Regards, Boris

sjngm
  • 12,423
  • 14
  • 84
  • 114
Boris
  • 71
  • 1
  • 3
  • 8
-1

In the Registry, delete unneccessary stuff. The key is HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs

Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
surya
  • 1
  • This is only half the job, the recent docs shell folder is full of shortcuts – Anders Jan 13 '11 at 22:15
  • Thanks for the answer! I'd like to find a way to find a way to remove the most recently startes application items from the Windows 7 Start Menu. – Boris Jan 14 '11 at 14:54