• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

How to launch a desktop .lnk file from within VB?

Show me how to launch an app, using it's desktop icon from within my VB app.
Shell doesn't seem to work.
There are parameters and switches used in the command line for the shortcut.
0
a6106a
Asked:
a6106a
  • 2
1 Solution
 
Dave_GreeneCommented:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal

lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String,


ByVal nShowCmd As Long) As Long

Const SW_NORMAL = 1

sLNK = "C:\WINDOWS\DESKTOP\Whatever.lnk"

ShellExecute hwnd, "open", sURL, vbNullString, vbNullString, SW_NORMAL
0
 
Dave_GreeneCommented:
Sorry..

Need to change this line

ShellExecute hwnd, "open", sLNK, vbNullString, vbNullString, SW_NORMAL

Cheers  :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now