Results 1 to 2 of 2

Thread: run specified application.

  1. #1
    Guest
    Hello,

    Can anyone can tell me how can i run a program outside
    my application optional parameters and please give
    example.

    thanks.


  2. #2
    Guest
    You can use the Shell function that is part of VB.
    Shell will only launch executable files, but you may add parameters along with it.

    Code:
    Shell "C:\MyProgram\Program.exe '/a /b /parameters
    
    'You can also have it return a TaskID
    RetVal = Shell("C:\MyProgram\Program.exe /a /b /parameters", vbNormalFocus)
    
    Shell "Notepad.exe C:\MyFile.txt", 1
    Or you can use the ShellExecute API function which will load any file with it's default application.

    Code:
    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
    
    Usage
    
    ShellExecute Me.hwnd, vbNullString, "C:\txtfile.txt", _
    vbNullString, "c:\", SW_SHOWNORMAL

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