I know that the CRecentFileList
constructor lets you specify an lpszSection
as a key.
According to the latest documentation for the Add
method, it accepts a file path and states:
virtual void Add(LPCTSTR lpszPathName);
virtual void Add(
LPCTSTR lpszPathName,
LPCTSTR lpszAppID);
void Add(
IShellItem* pItem,
LPCTSTR lpszAppID);
void Add(
IShellLink* pLink,
LPCTSTR lpszAppID);
void Add(
PIDLIST_ABSOLUTE pidl,
LPCTSTR lpszAppID);
As you can see, it has the second parameter lpszAppID
and the documentation says:
Specifies Application User Model ID for the application.
What is the purpose of this lpszAppID
parameter since it does not seem to be used in the MFC code at all? e.g. the API allows us to get the string by using the []
operator but what's the point of lpszAppID
?
Side point, why do we have to create these CRecentFileList
objects with new
? All sample code seem to do this.
The code is old. And so for compatibility there are still pointers used. But it is just the internal implementation. The user doesn't sees it.
The recent file is also added to the global recent file list with
SHAddToRecentDocs
, and this function may use the given id to locate your program to open the file. See the documentation there.Also this app ids are used in the Windows Toasts, from where it is also possible to open files or link to actions in your application.
Looking at the source code for MFC we can see this: