CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Location
    Austria
    Posts
    17

    start a program from a program - shortcut

    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?


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: start a program from a program - shortcut

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured