Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   Code Library (http://www.xtremevbtalk.com/code-library/)
-   -   Create Shortcuts with the IShellLinkA Interface (http://www.xtremevbtalk.com/code-library/152821-create-shortcuts-ishelllinka-interface.html)

OnErr0r 03-13-2004 07:45 PM

Create Shortcuts with the IShellLinkA Interface
 
1 Attachment(s)
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 10: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.


All times are GMT -6. The time now is 05:27 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.