-
October 23rd, 2002, 10:33 AM
#1
Launching a Shortcut from VB
With ref to my previous problem about displaying files I which I cannot work out I have the a listview with the filenames of shortcuts which are retrieved from the Start Menu.
eg. C:\windows\Start Menu\Product Support\Payroll\Help Files\Printers.lnk
or
C:\windows\Start Menu\Product Support\Payroll\Web Links\Inland Revenue.url
How do I launch these shortcuts, I have tried the Shell command and also the ShellExecute API Call but neither work ?
API Used :
Public 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
and then called by :
ShellExecute 0&, "Open", FilePS.Path & "\" & Item, 0, 0, SW_NORMAL
-
October 23rd, 2002, 11:50 AM
#2
For the URL:
Dim ProcessID As Long
'Path to a web browser and path to URL
ProcessID = Shell("C:\Program Files\Internet Explorer\iexplore.exe C:\windows\Start Menu\Product Support\Payroll\Web Links\Inland Revenue.url", 1)
For the lnk file
Mak a .bat file called Printers.bat with the path to the lnk file and then execute the .lnk file from the batch file as follows:
ProcessID = Shell("The path to printers.bat", 1)
-
October 23rd, 2002, 11:51 AM
#3
you can also use:
"cmd.exe /c start <url/link>"
for winme/9x, use command.exe instead of cmd.exe
-Cool Bizs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|