Sub AnnounceWMP(artist As String, Title As String, Album As String)
Dim cpd As CopyData
Dim msgr As HWND
Dim Found As Integer
Dim wmsg As WString * 500
Dim As WString * 30 WMContentID = "WMContentID"
Dim As WString * 500 MSNMusicString = !"PsyMP3\\0Music\\0%d\\0%s\\0%s\\0%s\\0%s\\0%s\\0"
Dim As WString * 100 FormatStr = "PsyMP3: {1} - {0}"
Dim As WString * 500 WTitle, WArtist, WAlbum
MultiByteToWideChar(CP_UTF8, 0, StrPtr(artist), Len(artist), WArtist, Len(artist))
MultiByteToWideChar(CP_UTF8, 0, StrPtr(Title), Len(Title), WTitle, Len(Title))
MultiByteToWideChar(CP_UTF8, 0, StrPtr(Album), Len(Album), WAlbum, Len(Album))
wsprintfW(wmsg, MSNMusicString, 1, FormatStr, WTitle, WArtist, WAlbum, WMContentID)
cpd.dwData = 1351
cpd.cbData = (Len(wmsg) * 2) + 2
cpd.lpData = @wmsg
Do
msgr = FindWindowEx(HWND_MESSAGE, msgr,"MsnMsgrUIManager", 0)
If msgr = 0 Then
Do
msgr = FindWindowEx(0, msgr,"MsnMsgrUIManager", 0)
If msgr = 0 Then
If Found = 0 Then Printf(!"Cannot find messenger for announce!\n")
Exit Do, Do
EndIf
SendMessage(msgr, WM_COPYDATA, 0, @cpd)
Found = 1
Loop
EndIf
SendMessage(msgr, WM_COPYDATA, 0, @cpd)
Found = 1
Loop
End Sub