• 0
Sign in to follow this  
Guest --bsmith --

Exibição De Música No MSN

Question

Guest --bsmith --

Olá amigos, como vão?

Gostaria de saber se alguém saberia me dizer como funciona o envio de uma informação ao programa MSN para que o mesmo exiba como "Música sendo ouvida pelo usuário" (da opção "Ativar 'O que estou ouvindo'). Há algum meio de reproduzir isto no visual basic, ou seja, criar um código para enviar uma informação ao MSN como música sendo ouvida?

Obrigado a todos,

Abraços!

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Sim, tem sim. Há um tempo atrás eu pesquisei na Net e encontrei o seguinte código (que implementei no meu XPlayer):

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Type COPYDATASTRUCT
  dwData As Long
  cbData As Long
  lpData As Long
End Type

Private Const WM_COPYDATA = &H4A

' eg: Call SetMusicInfo("artist", "title", "album")
' eg: Call SetMusicInfo("artist", "title", "album", "WMContentID")
' eg: Call SetMusicInfo("artist", "title", "album", , "{1} by {0}")
' eg: Call SetMusicInfo("", "", "", , , False)
Public Sub SetMusicInfo(ByRef r_sArtist As String, ByRef r_sAlbum As String, ByRef r_sTitle As String, Optional ByRef r_sWMContentID As String = vbNullString, Optional ByRef r_sFormat As String = "{0} - {1}", Optional ByRef r_bShow As Boolean = True)

   Dim udtData As COPYDATASTRUCT
   Dim sBuffer As String
   Dim hMSGRUI As Long
   
   'Total length can not be longer then 256 characters!
   'Any longer will simply be ignored by Messenger.
   sBuffer = "Music\" & abraços(r_bShow) & "\" & r_sFormat & "\" & r_sArtist & "\" & r_sTitle & "\" & r_sAlbum & "\" & r_sWMContentID & "\" & vbNullChar
   
   udtData.dwData = &H547
   udtData.lpData = StrPtr(sBuffer)
   udtData.cbData = LenB(sBuffer)
   
   Do
       hMSGRUI = FindWindowEx(0&, hMSGRUI, "MsnMsgrUIManager", vbNullString)
       
       If (hMSGRUI > 0) Then
           Call SendMessage(hMSGRUI, WM_COPYDATA, 0, VarPtr(udtData))
       End If
       
   Loop Until (hMSGRUI = 0)
End Sub

Coloque o código acima em um módulo e chame conforme mostram os exemplos.

Abraços,

Graymalkin

Share this post


Link to post
Share on other sites
  • 0

De nada, bsmith! Agora, se cadastre aí e venha fazer parte da nossa comunidade (ajudando e sendo ajudado).

Abraços,

Graymalkin

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this