views:

848

answers:

5

I want to be able to change the status message for Live Messenger, but everything I've found only works for the music message (see this screenshot to see the difference between the two).

It is possible to do this, as there are programs that have the ability to change it, and some alternate clients for Live Messenger can also set the status message themselves. I just need to know how to do this myself.

Clarification: The solution needs to work with the latest versions of Live Messenger (i.e. the wave 3 beta). Working with older versions is good too, but it's the 14.x versions that I'm working with.

+1  A: 

Of course, from any conversation windows, a simple "/psm new message" would update the message status field.

But programmatically:

You will find here a VB source file which sent a new message to the PSM (Personal Satus Message) of your Live Messenger windows. May be that would help.

extract:

Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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 Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_COMMAND = &H111
Private Const WM_CHAR = &H102
Private Const VK_RETURN = &HD

Private Function SetPSM(ByVal text As String) As Boolean
   Dim hParentWnd, hChildWnd As Long
   SetPSM = False
   hParentWnd = FindWindow("MSBLWindowClass", vbNullString)
   If hParentWnd <> 0 Then
      hChildWnd = FindWindowEx(hParentWnd, 0, "DirectUIHWND", vbNullString)
      If hChildWnd <> 0 Then
         PostMessage hParentWnd, WM_COMMAND, 56606, 0
         Dim i As Integer
         For i = 1 To Len(text)
            Call PostMessage(hChildWnd, WM_CHAR, Asc(Mid$(text, i, 1)), 0)
         Next i
         PostMessage hChildWnd, WM_CHAR, VK_RETURN, 0
         SetPSM = True
      End If
   End If
End Function

Private Sub cmdSetPSM_Click()
   SetPSM txtPSM.text
End Sub
VonC
The /psm "trick" doesn't work. Just tried it on 14.0.5027.908 (the current public beta).
Chris Charabaruk
Similarly, the code doesn't, either. FindWindow returns 0 for MSBLWindowClass.
Chris Charabaruk
Works flawlessly on the 8.5.1302.1016
VonC
If I were using 8.5 I wouldn't have needed to ask this question. There's already a program that does exactly what I want to do that works with 7.x-8.5. And besides ,something that can't keep up to date shouldn't be kept.
Chris Charabaruk
+1  A: 

You can install over your MSN MsgPlus that will give you an API to program over MSN. You can then create a script that calls your program or a program that calls MSN.

Daok
I'm not going to pad out my programs with 3rd party cruft to do something I can accomplish without said cruft. Doing such is wholly irresponsible.
Chris Charabaruk
A: 

There is no programmatic way of setting the Live Messenger status message that works with versions inclusive of Live Wave 3.

Chris Charabaruk
A: 

You could possibly go for the messy work-around, using windows API functions to simulate user input.

A: 

Chris, how to set the music message programmatically?

Bill Li