By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 2,753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

Create Desktop Icon

P: n/a
I am trying to create a desktop icon using VB6. is this possible?

-p
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
http://www-level3.experts-exchange.c..._20710687.html

gl,
Henk
"Eskimo Joe" <jo*@joe.com> wrote in message
news:nEenb.42869$B_2.28773@okepread02...
I am trying to create a desktop icon using VB6. is this possible?

-p

Jul 17 '05 #2

P: n/a
What exactly are you trying to achieve? Have an icon for one of your
programs on the desktop?
Or write a VB program to create icons?

Option 1 - you dont need to use VB
Option 2 - lots of products out there already

"Eskimo Joe" <jo*@joe.com> wrote in message news:<nEenb.42869$B_2.28773@okepread02>...
I am trying to create a desktop icon using VB6. is this possible?

-p

Jul 17 '05 #3

P: n/a
if you'd like to use some code to do it, check here...

http://www.mvps.org/vbnet/index.html...esktoplink.htm

D.
Samuel Hon wrote:
What exactly are you trying to achieve? Have an icon for one of your
programs on the desktop?
Or write a VB program to create icons?

Option 1 - you dont need to use VB
Option 2 - lots of products out there already

"Eskimo Joe" <jo*@joe.com> wrote in message news:<nEenb.42869$B_2.28773@okepread02>...
I am trying to create a desktop icon using VB6. is this possible?

-p


Jul 17 '05 #4

P: n/a
'This quick routine will create a shortcut to the Desktop, The StartMenu and
the Startup folder without the use of the Windows API. The example also
shows a method of deleting the shortcuts.
Public Sub CreateShortcut()
Dim DT As Integer 'Desktop reference integer
Dim ST As Integer 'StartMenu reference integer
Dim WshShell As Object
Dim oShellLink As Object
Dim sStartMenu As String 'Container for Start Menu location
Dim sStartup As String 'Container for Startup Menu
location
Dim sDesktop As String 'Container for Desktop location
Dim sWindows As String 'Container/Identifier for OS folder
location

Set WshShell = CreateObject("WScript.Shell")
'Define the folder as StartMenu
sStartMenu = WshShell.SpecialFolders("StartMenu")
'Define the folder as Startup
sStartup = WshShell.SpecialFolders("Startup")
'Define the folder as Desktop
sDesktop = WshShell.SpecialFolders("Desktop")
'Define the location of the application
sWindows = App.Path

'Create Desktop shortcut:
' DT represents a True/False value of a checkbox to Add or Delete the
shortcut
If DT = 1 Then
Set oShellLink = WshShell.CreateShortcut(sDesktop &
"\Stickems.exe.lnk")
oShellLink.TargetPath = sWindows & "\Stickems.exe"
oShellLink.IconLocation = sWindows & "\Stickems.exe, 0"
oShellLink.Description = "Stickems shortcut"
oShellLink.WorkingDirectory = sWindows
oShellLink.Save
End If

'Create ShortCut in Start Menu.
' ST represents a True/False value of a checkbox to Add or Delete the
shortcut
If ST = 1 Then
Set oShellLink = WshShell.CreateShortcut(sStartMenu &
"\Stickems.exe.lnk")
oShellLink.TargetPath = sWindows & "\Stickems.exe"
oShellLink.IconLocation = sWindows & "\Stickems.exe, 0"
oShellLink.Description = "Stickems shortcut"
oShellLink.WorkingDirectory = sWindows
oShellLink.Save

'Create ShortCut in Startup Menu.

Set oShellLink = WshShell.CreateShortcut(sStartup &
"\Stickems.exe.lnk")
oShellLink.TargetPath = sWindows & "\Stickems.exe"
oShellLink.IconLocation = sWindows & "\Stickems.exe, 0"
oShellLink.Description = "Stickems shortcut"
oShellLink.WorkingDirectory = sWindows
oShellLink.Save
End If

Set oShellLink = Nothing
Set WshShell = Nothing
End Sub
'This Procedure will Remove the icon from your Desktop.

Public Sub Check2_Click()
On Error GoTo ErrorHandler

If Check2.Value = vbUnchecked Then
ST = 0
Kill sStartMenu & "\Stickems.exe.lnk"
Kill sStartup & "\Stickems.exe.lnk"
ShortCut = "False"
Exit Sub
End If
If Check2.Value = vbChecked Then
ST = 1
CreateShortcut
ShortCut = "True"
End If
Exit Sub
ErrorHandler:
End Sub
"Eskimo Joe" <jo*@joe.com> wrote in message
news:nEenb.42869$B_2.28773@okepread02...
I am trying to create a desktop icon using VB6. is this possible?

-p

Jul 17 '05 #5

P: n/a
Do you mean a Desktop shortcut?
There's a very basic class, named SHELLLNK.CLS, in
the tools\unsuppported folder of the VB CD. There's
also a smalll TLB with it. Set a reference to the TLB
and add the class to your project. You'll then have a function
for making shortcuts.

--
--
Eskimo Joe <jo*@joe.com> wrote in message
news:nEenb.42869$B_2.28773@okepread02...
I am trying to create a desktop icon using VB6. is this possible?

-p

Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.