Results 1 to 4 of 4

Thread: Open a third party application

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2000
    Posts
    140
    Hi there,

    I would like to know if it's possible to open a third party application from VB.

    I have a form and a button. On click of the button, I would like to be able to open up an application (for example Drawme).

    Thanks in advance.


  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Shell "programname.exe"

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Yep that's true, use this code if you want to open a file with it's default program (even urls!)

    Code:
    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
    
    'Open a file with it's default program
    Public Sub Execute(file As String)
    ShellExecute(hWnd, "Open", file, "", "", vbNormalFocus)
    End Sub
    
    'Usage
    'Call Execute("c:\Drawme.drw")
    have fun

    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Guest
    Or if you want to open a file with a specific program, use the Shell method and pass the file for the command line argument.
    Code:
    Shell "Notepad.exe MyFile.txt", 1

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