Ok ... quello che puoi fare è chiudere la prima applicazione e aprire una seconda ...
codice:
Private Const WM_CLOSE = &H10
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_Load()
Dim SongFileName As String
SongFileName = Command$
Dim lonPos As Long, lonEnd As Long
Dim strStart As String, strEnd As String
Dim strEmail As String
Dim html As String
html = SongFileName
'The start string.
strStart = """"
strEnd = """"
Me.Caption = ""
Dim hwndApp As Long
If App.PrevInstance Then
hwndApp = FindWindow("ThunderRT6FormDC", "Player")
If hwndApp Then
Call SendMessage(hwndApp, WM_CLOSE, 0, 0)
End If
End If
Me.Caption = "Player"
'Find the start string.
lonPos = InStr(1, html, strStart, vbTextCompare)
If lonPos > 0 Then
'Move to the end of the start string
'which happens to be the beginning of what we're looking for.
lonPos = lonPos + Len(strStart)
'Find the end string starting from where we found the start.
lonEnd = InStr(lonPos, html, strEnd, vbTextCompare)
If lonEnd > 0 Then
'Now, we have the starting and ending position.
'What we do is extract the information between them.
'The length of data (e-mail address) will be:
'lonEnd - lonPos
strEmail = Mid$(html, lonPos, lonEnd - lonPos)
'Done!
WindowsMediaPlayer1.URL = strEmail
End If
End If
End Sub