HI!
Anyone here got idea to add shortcut in DEsktop automatically run( using Package and Deploy Wizard)?Izzt it is possible to to?

Dani AI

Generated

Short answer: yes — create the shortcut at runtime (per‑user) is the simplest reliable option, or let the installer create it when the installer knows the final path. already outlined the tradeoffs and pointed to using a proper installer. The snippet below is a compact VB6 routine that creates a per‑user desktop shortcut and will attempt the all‑users desktop when available; it avoids hard‑coding install paths so the shortcut always points to the actual installed EXE.

' VB6: create or update a desktop shortcut (per-user by default)
Sub CreateDesktopShortcut(shortName As String, Optional installPath As String, Optional allUsers As Boolean = False)
    Dim wsh As Object, destFolder As String, sc As Object
    If installPath = "" Then installPath = App.Path
    Set wsh = CreateObject("WScript.Shell")

    If allUsers Then
        On Error Resume Next
        destFolder = wsh.SpecialFolders("AllUsersDesktop")
        If Err.Number <> 0 Or destFolder = "" Then destFolder = wsh.SpecialFolders("Desktop")
        On Error GoTo 0
    Else
        destFolder = wsh.SpecialFolders("Desktop")
    End If

    Set sc = wsh.CreateShortcut(destFolder & "\" & shortName & ".lnk")
    sc.TargetPath = installPath & "\" & App.EXEName & ".exe"
    sc.WorkingDirectory = installPath
    sc.IconLocation = sc.TargetPath & ",0"
    sc.Save

    Set sc = Nothing
    Set wsh = Nothing
End Sub

Practical notes and troubleshooting:

  • Creating an all‑users desktop shortcut requires administrative rights (UAC/elevation on Vista+); fallback to per‑user when elevation is not available.
  • Check for and overwrite existing .lnk files to avoid duplicates. The routine above updates an existing shortcut.
  • When an installer is used (Inno/NSIS/etc.) bind the icon creation to a task/option so the "create desktop icon" checkbox actually controls the icon; if an icon appears despite the option, inspect the installer's task/default flags (this is the cause behind 's report).
  • For legacy PDW-based setups that cannot express install‑time choices reliably, prefer the runtime approach above or switch to a modern installer as suggested by .

Recommended workflow: for VB6/PDW-era projects add the shortcut code to a first-run step (per‑user) and use the installer for any all‑users actions that require elevation. This keeps shortcuts correct regardless of the final install folder.

Recommended Answers

All 4 Replies

3 ways u could do it:

1) make a shortcut and place it in the cab file generated, then edit the setup file and add the path to it and it will unzipp to the desktop. Drawbacks: if they choose to install your app in another folder, the shortcut wont work.

2) When the program is run make it add a shortcut to the desktop (i lost the code but if i find it ilol post it.

3) dont use the pakaging and deployment sytem, use another install creator eg Install Creator Pro. Drawbacks: you will probably have to use the pakage and deployment wizard to find out where the files need to go and then put them into the install creator manually.

hope that helps.

I use Inno setup Compiler and added the line to the ICONS section near the end.

Name: "{userdesktop}\Name of Program"; Filename: "{app}\myprorgram.exe"; Tasks: desktopicon; WorkingDir: "{app}"

(Name of program is what shows up as Tooltip msg)
By assigning the App to a variable it will keep track of where the program is when installed to non-default directory.

Or you can scourge through S&D wizard and figure it out. The program I developed is 231mb uncompressed but compressed as a setup.exe is comes out to 57mb.

Hope that helps
Kegtapper

Hello all,
Could anyone plz tell me how to add desktop icon on request.
I'm using Inno Setup. My code is,
Name: "{userdesktop}\S/W [S/W-VERSION]"; Filename: "{app}\S/W.exe"; WorkingDir: "{app}"; Tasks: desktopicon singleuser
Name: "{commondesktop}\S/W [S/W-VERSION]"; Filename: "{app}\S/W.exe"; WorkingDir: "{app}"; Tasks: desktopicon allusers

This one is creating the desktop icon by default. I want it only on selection. The selection variable here is desktopicon

Hi Maylim26,
As said by Maca007 use Install Creator/Maker instead of pakaging and deployment system. Here I user "Create Install Free" which i downloaded from website using Google. This Install maker is User-friendly to use. With this Install Creator you can do Registering Objects, Registry Entry Adding Shortcuts etc.

About SuganSumi's post, I think this is a new post. Instead of Posting on others thread try to post your own thread with different topic so that you can have maximum chances to solve your thread.

Thankx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.