Solved

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

Posted on 2001-07-12
2
186 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now