Programmatically access most frequently used apps

2019-07-03 05:43发布

问题:

The Windows 8.1 start menu provides a list of apps that can be sorted by most used (Windows Button > Down arrow > Apps: by most used). Is there a way to programmatically get a list of these apps in this order in C#? If not in this order, at least a list of the most used and/or moderately used apps as displayed in the Windows 8.1 start menu?

回答1:

The answer is probably yes, you can, though it's not recommended (nor easy).

Raymond Chen described this pretty clearly in his blog post, "Why is there no programmatic access to the Start menu pin list?". It talks about a different issue on Windows XP, but I think the moral of the story applies here as well, that this information is too easily abused and thus no public API is available. Stackoverflow also has a question that addresses the MFU list directly (see this question), and the answers are that you just shouldn't do it.

The thing is, the MFU list you see is stored in the UserAssist section of the registry, and its values are encrypted (used to be ROT13, but I have no idea for 8.1). Didier Stevens wrote a GUI that decrypts the values (see blog post), but it has not been updated since 8.1 came out. For what its worth the author has included the source code but it's for an older version. You can probably expand on his code to make it support 8.1 if you can do cryptanalysis.