?
Solved

How Can I launch another application in Visual Basic?

Posted on 2003-02-26
4
Medium Priority
?
165 Views
Last Modified: 2013-11-25
i am making a winamp controller app and i want winamp.exe in the same directory as my plugin to load up.

How Can i do this?

Please Help

Or Can i make a button to launch the application?
0
Comment
Question by:pig_dog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 400 total points
ID: 8025270
Private Sub Command1_Click()
Dim AppPath As String

If Right(App.Path, 1) <> "\" Then
    AppPath = App.Path & "\"
Else
    AppPath = App.Path
End If

Shell AppPath & "Winamp.exe", vbNormalFocus

End Sub
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 8025338
you could also use shellexecute api. It will open anyfile with it's default application.

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 Sub Command1_Click()
Call ShellExecute(hwnd, "Open", ("C:\Somefile.mp3"), "", App.Path, 1)
End Sub
0
 
LVL 1

Expert Comment

by:Smashmad
ID: 8026608
'You can open winamp, and specify a file to open, or append a file to the playlist


you can use this functions as you want..
Private Sub Command1_Click()

call Winamp 'abre el winamp
call openFile("c:\My First Mp3 file.mp3") 'opens that file
call Enquee("c:\MyMp3.mp3") 'adds MyMp3.mp3 to the playlist

End Sub


'TO OPEN WINAMP ONLY
Private Sub Winamp()
Dim NewPath As String

If Right(App.path, 1) <> "\" Then
   NewPath = App.path & "\"
Else
   NewPath = App.path
End If
Shell (NewPath & "winamp.exe")

End Sub


'TO ENQUEE A FILE
Private Sub Enquee(file As String)
Dim NewPath As String

If Right(App.path, 1) <> "\" Then
   NewPath = App.path & "\"
Else
   NewPath = App.path
End If

Shell (NewPath & "winamp.exe /ADD " & Chr(34) & file & Chr(34))

End Sub


'TO OPEN A FILE
Private Sub openFile(file As String)
Dim NewPath As String

If Right(App.path, 1) <> "\" Then
   NewPath = App.path & "\"
Else
   NewPath = App.path
End If

Shell (NewPath & "winamp.exe " & Chr(34) & file & Chr(34))

End Sub
0
 

Author Comment

by:pig_dog
ID: 8032352
Thankyou For TAKING THE TIME TO HELP ME, enjoy your points.

Thnks againg - Works a treat.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question