| | |
Closing external application
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
Hi,
Try :
extApplication = System.Diagnostics.Process.Start("winamp.exe http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=8234&file=filename.pls")
You might need to put full path to winamp.exe if it isn't in your PATH encironment variable.
Loren Soth
Try :
extApplication = System.Diagnostics.Process.Start("winamp.exe http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=8234&file=filename.pls")
You might need to put full path to winamp.exe if it isn't in your PATH encironment variable.
Loren Soth
Best regards,
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
•
•
Join Date: Apr 2006
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by jerMAn
Ok, I have been using Microsoft's SAPI, to "well try to do everything"
And have had alot of success. I can open applications, play music, calculate math equations, and even retreive defenitions of words from "www.dictionary.com" using WinSock.
I designed it, much like StarTrek TNG. I say "computer" and the sound from the TV show plays, then I can give commands.
OK, now I have a new Sub that opens WinAmp and a specific radio station.
It actually opens a browser with a specific string, then the browser opens WinAmp and the music plays.
VB.NET Syntax (Toggle Plain Text)
Sub PlayGenre(ByVal strGenre As String) ' plays a sound letting me know the command was recognized PlayWav("C:\VB6SBS\TTS testing\New Folder (3)\c55.wav") ' trying to get a handle on WinAmp Dim myProcess As Process = New Process myProcess.StartInfo.FileName = "winamp.exe" ' determine what genre was asked for and open the webpage Select Case strGenre Case "jazz" System.Diagnostics.Process.Start("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls") Case "house" System.Diagnostics.Process.Start("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6151&file=filename.pls") Case "rock alternative" System.Diagnostics.Process.Start("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=7659&file=filename.pls") Case "blues" System.Diagnostics.Process.Start("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6999&file=filename.pls") Case "new Orleans" System.Diagnostics.Process.Start("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=7421&file=filename.pls") Case "big band" System.Diagnostics.Process.Start("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=1160&file=filename.pls") Case "alternative" System.Diagnostics.Process.Start("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=5004&file=filename.pls") Case Else myProcess.Kill() ' if not recognized try to close winamp End Select End Sub
I am trying to close the WinAmp Application using
VB.NET Syntax (Toggle Plain Text)
' called at the beginning of the SUB Dim myProcess As Process = New Process myProcess.StartInfo.FileName = "winamp.exe" ' ' then in any case else situation Case Else myProcess.Kill()
But this isn't working.
I am thinking maybe I need to instead of calling the webpage, that I need to open WinAmp as a Shell statement and somehow pass what station I want to play. I would have control over the handle.
I'll pop over to the WinAmp forums, but I doubt they will be much help.
wimamp is not a utility in OS, so u have to mention the full path of this in ur program then only it will work
All the best
•
•
Join Date: Jun 2005
Posts: 28
Reputation:
Solved Threads: 0
That didn't work, but this did, well sorta.
extApplication = System.Diagnostics.Process.Start("C:\Program Files\Winamp\winamp.exe")
WinAmp.AppendFileToPlaylist("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls")
WinAmp.Play()
I used your code to opne WinAmp, then I used an Active control bundled with Winamp to control it.
I was unable to use the ActiveX control before. ( I didn't have a handle )
The problem now is that the voice activation program is normally minimized. This only seems to work if the program is maximized.
I tried this:
WinAmp = System.Diagnostics.Process.Start("C:\Program Files\Winamp\winamp.exe")
WinAmp.AppendFileToPlaylist("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls")
WinAmp.Play()
But no good...
OK Wait, this works... It's ugly, but it works...
This obviously sets the window to normal, momentarily, then does it's task, then minimizes again.
The strange thing is, that to stop the music playing, does not require me to do this.
Now I need to be able to change stations.
How would I check if extApplication has any value?
I tried:
If extApplication <> 0 Then
' do events
End if
and
If extApplication <> "" Then
' do events
End if
But of course extApplication is neither a string nor integer so an error was produced.
I tried
extApplication.kill()
' then open winamp
but that didn't open anything.
Wait,,, what am I stupid...
A regular boolean variable....
I'll get back to you.
extApplication = System.Diagnostics.Process.Start("C:\Program Files\Winamp\winamp.exe")
WinAmp.AppendFileToPlaylist("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls")
WinAmp.Play()
I used your code to opne WinAmp, then I used an Active control bundled with Winamp to control it.
I was unable to use the ActiveX control before. ( I didn't have a handle )
The problem now is that the voice activation program is normally minimized. This only seems to work if the program is maximized.
I tried this:
WinAmp = System.Diagnostics.Process.Start("C:\Program Files\Winamp\winamp.exe")
WinAmp.AppendFileToPlaylist("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls")
WinAmp.Play()
But no good...
OK Wait, this works... It's ugly, but it works...
VB.NET Syntax (Toggle Plain Text)
Select Case strGenre Case "jazz" Me.WindowState = System.Windows.Forms.FormWindowState.Normal Me.ShowInTaskbar = True extApplication = System.Diagnostics.Process.Start("C:\Program Files\Winamp\winamp.exe") WinAmp.AppendFileToPlaylist("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls") WinAmp.Play() Me.WindowState = System.Windows.Forms.FormWindowState.Minimized Me.ShowInTaskbar = False
This obviously sets the window to normal, momentarily, then does it's task, then minimizes again.
The strange thing is, that to stop the music playing, does not require me to do this.
Now I need to be able to change stations.
How would I check if extApplication has any value?
I tried:
If extApplication <> 0 Then
' do events
End if
and
If extApplication <> "" Then
' do events
End if
But of course extApplication is neither a string nor integer so an error was produced.
I tried
extApplication.kill()
' then open winamp
but that didn't open anything.
Wait,,, what am I stupid...
A regular boolean variable....
I'll get back to you.
•
•
Join Date: Jun 2005
Posts: 28
Reputation:
Solved Threads: 0
Ok this is a little confusing, but works perfectly:
Notice I removed the extApplication altogether...
For some reason now the ActiveX control is working.
I think maybe before I was just not getting a connection to the server. ( likely the server was full )
Now I guess I will need to find a way to return if the server is full, and pass a message to the user.
In any case thanks again. Now I know a better way to open and control Apps in VB>NET versus using Shell like in the past.
Thanks!
VB.NET Syntax (Toggle Plain Text)
Select Case strGenre Case "jazz" If boolRadioIsPlaying = False Then boolRadioIsPlaying = True Me.WindowState = System.Windows.Forms.FormWindowState.Normal Me.ShowInTaskbar = True 'extApplication = System.Diagnostics.Process.Start("C:\Program Files\Winamp\winamp.exe") strCurrentStation = "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls" WinAmp.AppendFileToPlaylist(strCurrentStation) WinAmp.Play() Me.WindowState = System.Windows.Forms.FormWindowState.Minimized Me.ShowInTaskbar = False Else WinAmp.ClearPlaylist() strCurrentStation = "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls" WinAmp.AppendFileToPlaylist(strCurrentStation) WinAmp.Play() End If
Notice I removed the extApplication altogether...
For some reason now the ActiveX control is working.
I think maybe before I was just not getting a connection to the server. ( likely the server was full )
Now I guess I will need to find a way to return if the server is full, and pass a message to the user.
In any case thanks again. Now I know a better way to open and control Apps in VB>NET versus using Shell like in the past.
Thanks!
•
•
Join Date: Jun 2005
Posts: 28
Reputation:
Solved Threads: 0
Ok here's the final code:
BTW - How do I set this post as being solved?
Or does the MOD do that?
VB.NET Syntax (Toggle Plain Text)
Sub PlayGenre(ByVal strGenre As String) PlayWav("C:\VB6SBS\TTS testing\New Folder (3)\c55.wav") Select Case strGenre Case "jazz" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6390&file=filename.pls") Case "house" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6151&file=filename.pls") Case "rock alternative" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=3211&file=filename.pls") Case "rock alternative to" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=7659&file=filename.pls") Case "blues" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=6999&file=filename.pls") Case "new Orleans" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=7421&file=filename.pls") Case "big band" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=1160&file=filename.pls") Case "experimental" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=8952&file=filename.pls") Case "industrial" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=113553&file=filename.pls") Case "psychedelic" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=222275&file=filename.pls") Case "classical contemporary" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=307275&file=filename.pls") Case "classic rock" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=716112&file=filename.pls") Case "classic rock to" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=8234&file=filename.pls") Case "hip hop" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=2834&file=filename.pls") Case "dirty south" Call PlayRadio("http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=9956&file=filename.pls") Case Else PlayWav("C:\VB6SBS\TTS testing\New Folder (3)\c55.wav") Voice.Speak("Music genre unknown. Please re-specify", SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync) End Select End Sub '-------------------------------------------------- Sub PlayRadio(ByVal strCurrentStation As String) If boolRadioIsPlaying = False Then boolRadioIsPlaying = True Me.WindowState = System.Windows.Forms.FormWindowState.Normal Me.ShowInTaskbar = True WinAmp.AppendFileToPlaylist(strCurrentStation) WinAmp.Play() Me.WindowState = System.Windows.Forms.FormWindowState.Minimized Me.ShowInTaskbar = False Else WinAmp.ClearPlaylist() WinAmp.AppendFileToPlaylist(strCurrentStation) WinAmp.Play() End If End Sub
BTW - How do I set this post as being solved?
Or does the MOD do that?
![]() |
Similar Threads
- Launch external application from web document (HTML and CSS)
- Loading a Java String into a TextArea in an External Application - Please Help (Java)
Other Threads in the VB.NET Forum
- Previous Thread: Close all active mssql server connections from vb.net
- Next Thread: Slightly complex...
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





