O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Create Desktop or Start Menu Shortcuts

Problem

You want to add a new shortcut to the desktop or the Start menu.

Solution

Use COM Interop to access the Windows Script Host component, which provides a WshShell.CreateShortcut method.

Discussion

There are several approaches that you can take if you want to programmatically create a shortcut file. You can use an unmanaged call to a legacy API (such as the Visual Basic 6 setup toolkit DLL), create the file by hand (in which case you need an in-depth understanding of its proprietary format), or create a dedicated Windows Installer setup program. The easiest approach is to use the Windows Script Host component, which is included with the Windows operating system. You can interact with this COM component through ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required