Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

932 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

9 Experts available now in Live!

Get 1:1 Help Now