Kevin Provance
8/27/2010 4:19:00 AM
No. Bad. See Maya's post.
One of my error trapping and tracing libraries has a system info class,
which lists startup applications. I needed to read lnk files in the startup
folder. I used Ednamo's TLB to do it. No dist required. The referenced
code is compiled into your app. Source is also available if you want to
study typelibs. It's powerful stuff if you can learn the syntax.
"Gary" <nospam@nospam.com> wrote in message
news:%23dmSDnZRLHA.5172@TK2MSFTNGP06.phx.gbl...
: Try this (you just have to change the destination path):
:
: Sub CreateShortCut(DestDir As String, Programa As String, Descripcion As
: String)
: On Local Error Resume Next
:
'*******************************************************************************'
*' * Shortcut related methods.' *Dim WSHShellSet WSHShell =
CreateObject("WScript.Shell")Dim MyShortcut, MyDesktop, DesktopPath' Read
desktop path using WshSpecialFolders object' Create a shortcut object on the
desktopSet MyShortcut = WSHShell.CreateShortCut(GetPath(CSIDL_STARTUP) & "\"
&Descripcion & ".lnk")' Set shortcut object properties and save
itMyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings(DestDir
&Programa)MyShortcut.WorkingDirectory =
WSHShell.ExpandEnvironmentStrings(DestDir)MyShortcut.WindowStyle =
4MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(DestDir
&Programa & ", 0")MyShortcut.SaveEnd Sub"BeeJ" <nospam@nowhere.com> escribió
en el mensajenews:i571pj$od9$1@speranza.aioe.org...> OK, I googled and found
that there are at least three methods of creatinga shortcut that I can
understand. The fourth I am not to sure about.> I want to create a shortcut
in the SendTo folder for my app. Command$will have filenames to work
with.>> So what are the pros and cons of 2 and 3. I already read the cons
of 1.And 4 may be beyond me without sample code to look through.>> 1) use
fCreateShellLink (uses vb6stkit.dll).> 2) use SHAddToRecentDocs to create
the shortcut in the RECENT folder thenFileCopy to the desired folder.> 3)
use WSH to create the shortcut in the app folder then FileCopy it tothe
folder.> 4) use shelllnk.tlb ' i have no clue how to do this one.>> All
probably need the app creating the shortcut to Run as Admin on Vistaand 7.
Yes?> Would be best to not have to use Run As Admin.>>
: