Click to See Complete Forum and Search --> : start a program from a program - shortcut


FStocker
December 13th, 1999, 03:27 AM
i have to start a program from a shortcut, that is not in the same directory as the program,
shell(c:\...\xxx.lnk) does not work!
can anyone tell me how to start my program?

Lothar Haensler
December 13th, 1999, 04:28 AM
use ShellExecute API

option Explicit
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
private Const SW_SHOWNORMAL = 1

private Sub Command2_Click()
Call ShellExecute(me.hwnd, "open", "c:\notepad.exe.lnk", vbNullString, vbNullString, SW_SHOWNORMAL)
End Sub




starts a link in notepad.exe.lnk