Sunday, January 3, 2010

Create Shortcut using VB6

The following simple code example to create a shortcut. First of all, create a new module and name it "myshortcut" or whatever. After that, paste the code below :

Sub CreateShortCut(File As String, icon As String, iconindex As Long, Target As String)
Dim intFreeFile As Integer
File = File & ".url"
intFreeFile = FreeFile
Open File For Output As intFreeFile
Print #intFreeFile, "[InternetShortcut]"
Print #intFreeFile, "URL=" & Target
Print #intFreeFile, "IconFile=" & icon
Print #intFreeFile, "Iconindex=" & iconindex
Close intFreeFile
End Sub


Hopefully this code can be useful for you :)


No comments:

Post a Comment