A shortcut is a data object that contains data used to access another object in the shell. Using a shortcut, you can launch an application or open a document in another folder. Additionally, because the shell uses the contents of special directories to define what is in the Start menu and on the desktop, placing a shortcut in one of those special directories enables an application to appear in the Start menu or on the desktop.
To create a shortcut, call the SHCreateShortcut function. The following code example shows the prototype for this function.
BOOL SHCreateShortcut (LPTSTR szShortcut, LPTSTR szTarget);
The first parameter specifies the name and location of the shortcut. The second parameter is the file name of the application you want to start or the file you want to open.
You can retrieve a shortcut's target path by calling the SHGetShortcutTarget function. The following code example shows the prototype for this function.
BOOL SHGetShortcutTarget (LPTSTR szShortcut, LPTSTR szTarget,
int cbMax);
The first parameter is the shortcut file name. The remaining two parameters are the buffer that receives the target file name of the shortcut and the size of that buffer.