Create Desktop Icon

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eskimo Joe

    #1

    Create Desktop Icon

    I am trying to create a desktop icon using VB6. is this possible?

    -p


  • Henk ten Bos

    #2
    Re: Create Desktop Icon



    gl,
    Henk
    "Eskimo Joe" <joe@joe.com> wrote in message
    news:nEenb.4286 9$B_2.28773@oke pread02...[color=blue]
    > I am trying to create a desktop icon using VB6. is this possible?
    >
    > -p
    >
    >[/color]


    Comment

    • Samuel Hon

      #3
      Re: Create Desktop Icon

      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" <joe@joe.com> wrote in message news:<nEenb.428 69$B_2.28773@ok epread02>...[color=blue]
      > I am trying to create a desktop icon using VB6. is this possible?
      >
      > -p[/color]

      Comment

      • dnagel

        #4
        Re: Create Desktop Icon

        if you'd like to use some code to do it, check here...



        D.


        Samuel Hon wrote:
        [color=blue]
        > 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" <joe@joe.com> wrote in message news:<nEenb.428 69$B_2.28773@ok epread02>...
        >[color=green]
        >>I am trying to create a desktop icon using VB6. is this possible?
        >>
        >>-p[/color][/color]

        Comment

        • MooVBuff

          #5
          Re: Create Desktop Icon

          '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("W Script.Shell")
          'Define the folder as StartMenu
          sStartMenu = WshShell.Specia lFolders("Start Menu")
          'Define the folder as Startup
          sStartup = WshShell.Specia lFolders("Start up")
          'Define the folder as Desktop
          sDesktop = WshShell.Specia lFolders("Deskt op")
          '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.Create Shortcut(sDeskt op &
          "\Stickems.exe. lnk")
          oShellLink.Targ etPath = sWindows & "\Stickems. exe"
          oShellLink.Icon Location = sWindows & "\Stickems. exe, 0"
          oShellLink.Desc ription = "Stickems shortcut"
          oShellLink.Work ingDirectory = 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.Create Shortcut(sStart Menu &
          "\Stickems.exe. lnk")
          oShellLink.Targ etPath = sWindows & "\Stickems. exe"
          oShellLink.Icon Location = sWindows & "\Stickems. exe, 0"
          oShellLink.Desc ription = "Stickems shortcut"
          oShellLink.Work ingDirectory = sWindows
          oShellLink.Save

          'Create ShortCut in Startup Menu.

          Set oShellLink = WshShell.Create Shortcut(sStart up &
          "\Stickems.exe. lnk")
          oShellLink.Targ etPath = sWindows & "\Stickems. exe"
          oShellLink.Icon Location = sWindows & "\Stickems. exe, 0"
          oShellLink.Desc ription = "Stickems shortcut"
          oShellLink.Work ingDirectory = 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" <joe@joe.com> wrote in message
          news:nEenb.4286 9$B_2.28773@oke pread02...[color=blue]
          > I am trying to create a desktop icon using VB6. is this possible?
          >
          > -p
          >
          >[/color]


          Comment

          • mayayana

            #6
            Re: Create Desktop Icon

            Do you mean a Desktop shortcut?
            There's a very basic class, named SHELLLNK.CLS, in
            the tools\unsupppor ted 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 <joe@joe.com> wrote in message
            news:nEenb.4286 9$B_2.28773@oke pread02...[color=blue]
            > I am trying to create a desktop icon using VB6. is this possible?
            >
            > -p
            >
            >[/color]


            Comment

            Working...