Vb.net And Windows Live Messenger Plugin

free web hosting
Free Web Hosting > Computers & Tech > Programming > Programming General > BASIC / Visual Basic (.NET)

Vb.net And Windows Live Messenger Plugin

Jimmy89
HI,
I am currently developing a media player for a friend. I amusing VB.Net and just making him a quick program. He asked whether it was possible to link it with the messenger live music plugin (like the one used in WMP). I said i'll get back to him on that.

What i would like to know is where to start? I have found a dll in the Live Messenger directory that can is called 'psmsong.8.1.0178.00.dll' and has a description of 'MSN Messenger Status Plugin' How can i implement this into the program. I have a way of passing current details (artist, album, song, current time, etc) but i just need to know how to get that to Live Messenger.

Thanks
-jimmy

Reply

FirefoxRocks
I don't know if it will help or not, but maybe taking a look at this will give you some ideas:

https://addons.mozilla.org/en-US/firefox/addon/2434

It's really old and obviously hasn't been updated, last support was for Firefox 1.5. But it is almost the same feature, putting the data in the Music portion of Windows Live Messenger.

Reply

Jimmy89
FirefoxRocks, Thanks for that link. That is the kind of idea I'm looking for, but I think i've solved my own problem. tongue.gif

I did a bit more digging around the Internet and stumbled upon the Fanatic Forums. I had a look around (its a great place for coding) and found a thread about this exact topic, and sure enough there was code on how to do it! Boy was i excited! tongue.gif I copied the code and right away it worked! I'll copy the code here for anyone that wants to have a look at it, but this is all from http://forums.fanatic.net.nz/.

Firstly, declare the following.
CODE
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 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 Const WM_COPYDATA As Short = &H4AS


Then, Put this code into the same form,
CODE
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 Structure COPYDATASTRUCT
        Dim dwData As Integer
        Dim cbData As Integer
        Dim lpData As Integer
    End Structure

    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 = "{1} - {0}", Optional ByRef r_bShow As Boolean = True)

        Dim udtData As COPYDATASTRUCT
        Dim sBuffer As String
        Dim hMSGRUI As Integer

        'Total length can not be longer then 256 characters!
        'Any longer will simply be ignored by Messenger.
        sBuffer = "Music\" & System.Math.Abs(CInt(r_bShow)) & "\" & r_sFormat & "\" & r_sArtist & "\" & r_sTitle & "\" & r_sAlbum & "\" & r_sWMContentID & "\" & vbNullChar

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

        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


And then, place these codes whenever you want to change or clear what is being sent to Messenger.

CODE
'Displays song info (MSN Messenger)
Call SetMusicInfo(My.Settings.CurrentArtistPlaying, "Not Passed", My.Settings.CurrentSongPlaying)
CODE
'Clear song info
Call SetMusicInfo("", "", "", , , False)

For some reason, the second variable in 'SetMusicInfo' doesn't pass to Messanger, not that bothers me cause i don't need it! This was tested with Windows Live Messenger 8.1 (Build 8.1.0178.00)

Enjoy!

 

 

 


Reply

iGuest
Strange Error
Vb.net And Windows Live Messenger Plugin

Hi there, this looks exactly what I need for a personal project I'm working on. However I keep on getting the error:

'Settings' is not a member of 'My'

The code works fine up to the point where I use the Call SetMusicInfo function. If I understand it correctly, this should appear in Sub Page_Load, whenever I want this to display.

Any ideas?

Thanks

Douglas

-question by Douglas

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. vb net live messenger - 6.05 hr back. (1)
  2. visual basic messenger - 6.44 hr back. (1)
  3. creating a messenger in vb 2008 - 17.73 hr back. (1)
  4. visual basic 2008 msn messenger - 18.17 hr back. (1)
  5. free live messenger plugins - 22.58 hr back. (1)
  6. plugin for wmp to display song info in wlm - 23.01 hr back. (1)
  7. messenger status visual basic - 24.85 hr back. (1)
  8. how to change plugins on windows live messenger - 46.46 hr back. (1)
  9. msn application visual basic vb.net 2008 - 46.69 hr back. (1)
  10. messenger visual basic 2008 - 48.75 hr back. (1)
  11. vb.net messenger - 42.40 hr back. (4)
  12. live messenger plugin für firefox - 50.70 hr back. (1)
  13. visual basic msn live - 51.87 hr back. (1)
  14. msn programs with vb.net - 54.44 hr back. (1)
Similar Topics

Keywords : vb, net, windows, live, messenger, plugin

  1. New Features In Visual Studio 2005 Windows Forms
    (1)
  2. Visual Basic: Change Your Start Button Text! (XP)
    Windows XP ONLY (16)
    Personally, I love this program I made for myself. What the following code will allow you to do is
    change the text of your start button (Duh). You can make it whatever you want, your name, a hobby,
    or even do some extra programming and get it to randomly cycle through captions every 30 seconds or
    so /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> . Here is all the code
    you'll need: CODE Private Const WM_SETTEXT = &HC Private Const WM_GETTEXT = &HD Private
    Declare Function FindWindow Lib "user32" Alias "FindWindowA" ....
  3. Windows XP Restart File? Restart Programmatically
    (3)
    Anyone knows where i can find the file or files that windows use to shutdown ? i'm buiding a
    software to shutdown my pc where ever i'm from, its a version beta , but my main problem
    isn't fixed . I hope you can help me . Wrong forum. Moved to Programming. ....

    1. Looking for vb, net, windows, live, messenger, plugin

Searching Video's for vb, net, windows, live, messenger, plugin
advertisement




Vb.net And Windows Live Messenger Plugin



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE