Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Put app in SendTo menu


'Get SendTo folder
Private Declare Function SHGetFolderPath Lib "shfolder" Alias "SHGetFolderPathA" ( ByVal hwndOwner As Long , _
        ByVal nFolder As Long , ByVal hToken As Long , ByVal dwFlags As Long , ByVal pszPath As String ) As Long
Private Const CSIDL_SENDTO As Long = &H9 '{user}\SendTo

Dim SendToFolder As String
Dim iReturn As Long
SendToFolder = String (MAX_PATH, 0)
iReturn = SHGetFolderPath(0, CSIDL, 0, SHGFP_Type_CURRENT, SendToFolder)

'Put shortcut there
'need reference in your program to Windows Script Host Object Model   wshom.ocx
'
Dim WS As WshShell
Dim oShellLink As WshShortcut

Set WS = New WshShell
Set oShellLink = WS.CreateShortcut( "C:\myapplication.lnk" ) 'all shotcuts End In .LNK
oShellLink.IconLocation = "C:\myapplication.ico"    'use for icon not In EXE file
oShellLink.Description = "My Installation"
oShellLink.WorkingDirectory = App.path     'your choice
oShellLink.TargetPath = App.Path & "\" & App.EXEName
oShellLink.Save
Set WS = Nothing
Set oShellLink = Nothing