Visualizzazione dei risultati da 1 a 7 su 7
  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2009
    Messaggi
    191

    [VB6]Apertura canzone Windows Media Player Control...

    Ciao a tutti, ho un piccolo problemino...
    Ho una applicazione che sfrutta il media player control...Facendo tasto destro su una canzone, cliccando su apri con e selezionando il mio programma, la canzone si pare perfettamente...Se ripeto l'operazione una seconda volta, mi si apre una seconda applicazione e le canzoni si sovrappongono...Come posso fare per far si che aprendo una seconda canzone, non si apra un secondo programma, ma nel primo si stoppi la canzone in esecuzione e parta la seconda?...Grazie mille a tutti...

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Scsua ... ma non avevi detto di avere già risolto usando la App.PrevInstance ?

    Come l'hai usata ?
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2009
    Messaggi
    191
    No, non ho risolto, perchè non so che codice mettere per stopprae la canzone 1 e aprire la canzone 2 nella stessa applicazione...Hmm...

  4. #4
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Perdonami ma forse ti stai confondendo ...

    Come avvii la canzone (diciamo la prima canzone) ? Con quale codice ?
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  5. #5
    Utente di HTML.it
    Registrato dal
    Apr 2009
    Messaggi
    191
    In questo modo:
    codice:
    Dim SongFileName As String
    SongFileName = Command$
    Dim lonPos As Long, lonEnd As Long
    Dim strStart As String, strEnd As String
    Dim strEmail As String
    html = SongFileName
    'The start string.
    strStart = """"
    strEnd = """"
    
    
    
    '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

  6. #6
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    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
    No MP tecnici (non rispondo nemmeno!), usa il forum.

  7. #7
    Utente di HTML.it
    Registrato dal
    Apr 2009
    Messaggi
    191
    Ancora una volta non posso fare altro che ringraziarti enormemente...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.