Solved

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

Posted on 2001-07-12
2
196 Views
Last Modified: 2008-03-17
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
Comment
Question by:a6106a
  • 2
2 Comments
 
LVL 8

Accepted Solution

by:
Dave_Greene earned 50 total points
ID: 6278391
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
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6278393
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question