Create Shortcuts with the IShellLinkA Interface

OnErr0r
03-13-2004, 06:45 PM
This example contains a class wrapper which will allow you to easily create shortcuts. I originally attempted to use my IShellLink type library from vb6, but due to marshalling problems with LPSTRs, it was not useful. In creating this example I came across a bug in VB (by design they say) which will not allow it to create COM CoClasses as C# can, by using the ComImport Attribute. Make sure to complain to MS about this.

Enjoy! :)

OnErr0r
08-03-2004, 09:14 AM
I accidentally omitted marshalling for one of the IShellLinkA methods:

This line:
Sub GetWorkingDirectory(ByVal pszDir As StringBuilder, ByVal cch As Integer)

should actually be:
Sub GetWorkingDirectory(<Out(), MarshalAs(UnmanagedType.LPStr)> ByVal pszDir As StringBuilder, ByVal cch As Integer)

Thanks to forum user name: nighty for pointing that out.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum