What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Skype & Live Messenger » Change Now Playing From Visual Basic .NET

Change Now Playing From Visual Basic .NET
Author: Message:
SuNcO
Full Member
***

Avatar

Posts: 128
Reputation: 6
45 / Male / Flag
Joined: Jan 2005
RE: Change Now Playing From Visual Basic .NET
On the same forum i see the answer (first i try to convert my own code but then i found it.. so i adapt to make it work)

code:
Public Class Form1

    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer

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

    Private Structure COPYDATASTRUCT
        Dim dwData As Integer
        Dim cbData As Integer
        Dim lpData As Integer
    End Structure

    Private Const WM_COPYDATA As Short = &H4AS

    Public Function VarPtr(ByVal o As Object) As Integer
        Dim GC As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(o, System.Runtime.InteropServices.GCHandleType.Pinned)
        Dim ret As Integer = GC.AddrOfPinnedObject.ToInt32

        GC.Free()
        Return ret
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        PonerMusica(TextBox1.Text)
    End Sub

    Public Sub PonerMusica(ByVal Texto)
        'Public Sub PonerMusica(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}", Optional ByRef r_bShow As Boolean = True)
        Dim udtData As COPYDATASTRUCT
        Dim sBuffer As String
        Dim hMSGRUI As Integer

        'sBuffer = "\0Music\0" & 1 & "\0" & "{0}" & "\0" & Texto & "\0" & "" & "\0" & "" & "\0" & vbNullString & "\0" & vbNullChar
        sBuffer = "\0Music\0" & System.Math.Abs(CInt(True)) & "\0" & "{1} - {0}" & "\0" & Texto & "\0" & "" & "\0" & "" & "\0" & vbNullString & "\0" & vbNullChar

        udtData.dwData = &H547
        udtData.lpData = VarPtr(sBuffer)
        udtData.cbData = Len(sBuffer) * 2

        Do
            ' Buscamos la seccion del Msn donde se pone la musica

            hMSGRUI = FindWindowEx(0, hMSGRUI, "MsnMsgrUIManager", vbNullString)

            ' La encontramos ?
            If (hMSGRUI > 0) Then
                ' Esta es la linea que envia el Texto
                Call SendMessage(hMSGRUI, WM_COPYDATA, 0, VarPtr(udtData))
            End If
        Loop Until (hMSGRUI = 0)
    End Sub
End Class


Source: http://forums.fanatic.net.nz/index.php?s=&showtop...w=findpost&p=83457

This post was edited on 11-23-2007 at 04:13 AM by SuNcO.
11-23-2007 04:12 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Change Now Playing From Visual Basic .NET - by andrewdodd13 on 11-22-2007 at 02:59 PM
RE: Change Now Playing From Visual Basic .NET - by SuNcO on 11-23-2007 at 04:12 AM
RE: Change Now Playing From Visual Basic .NET - by ShawnZ on 11-23-2007 at 06:02 AM
RE: Change Now Playing From Visual Basic .NET - by andrewdodd13 on 11-23-2007 at 06:07 PM
RE: Change Now Playing From Visual Basic .NET - by SuNcO on 11-23-2007 at 06:27 PM
RE: Change Now Playing From Visual Basic .NET - by andrewdodd13 on 11-23-2007 at 06:34 PM
RE: Change Now Playing From Visual Basic .NET - by SuNcO on 11-23-2007 at 07:29 PM
RE: RE: Change Now Playing From Visual Basic .NET - by andrewdodd13 on 11-23-2007 at 07:52 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On