TestPartner: Automating the creation of a Desktop Shortcut
The basic approach to creating a desktop shortcut for a program in a Script or Visual Test is to automate a right-click against the executable in Windows Explorer before selecting 'Send to > Desktop (create shortcut)' from the context menu. This type of approach generally works well but will fail on on Windows 8.1(32 bit) because the right-click context menu will not be recognized.
As an alternative to automating Windows Explorer you can instead use Shell's COM API to create the desktop shortcut as shown in the following function:
The CreateShortcut function accepts 2 parameters: the path to the executable and the name that you want to assign the shortcut once it's created on the desktop.
You can download a TestPartner Asset containing the code via the following link: