VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Easiest method to create shortcut - no API's required!

by 7Z Software (2 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 1st October 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Easiest method to create shortcut - no API's required!

API Declarations


Dim objShellLink As Object
Set objWshShell = CreateObject("WScript.Shell")


Rate Easiest method to create shortcut - no API's required!



' so don't use Option Explicit
' or just declare variables

strDesktop = objWshShell.SpecialFolders("Desktop")
Set objShellLink = objWshShell.CreateShortcut(strDesktop & "\Notepad.lnk")objShellLink.TargetPath = "C:\WINNT\NOTEPAD.EXE"  ' or  "http://www.microsoft.com"
   objShellLink.WindowStyle = 1
   objShellLink.Hotkey = "CTRL+SHIFT+F"
   objShellLink.IconLocation = "NOTEPAD.EXE, 0"
   objShellLink.Description = "This is my shortcut!"
   objShellLink.WorkingDirectory = strDesktop
   objShellLink.Save
   
   Set objShellLink = Nothing
   Set objWshShell = Nothing

Download this snippet    Add to My Saved Code

Easiest method to create shortcut - no API's required! Comments

No comments have been posted about Easiest method to create shortcut - no API's required!. Why not be the first to post a comment about Easiest method to create shortcut - no API's required!.

Post your comment

Subject:
Message:
0/1000 characters