All pastes #1359506 Raw Edit

segin

public text v1 · immutable
#1359506 ·published 2009-03-13 01:12 UTC
rendered paste body
Type CopyData
    dwData As Integer
    cbData As Integer
    lpData As Any Ptr
End Type

Sub ClearWMP()
   Dim cpd As CopyData
   Dim wmsg As WString * 500
   Dim msgr As HWND
   msgr = FindWindow("MsnMsgrUIManager", 0)
   If msgr = 0 Then
      Printf(!"Cannot find messenger for announce!\n")
      Return
   EndIf
   wmsg = "\0Music\00\0PsyMP3: {1} - {0}\0Title\0Artist\0Album\0WMContentID\0"
   cpd.dwData = 1351
   cpd.cbData = (Len(wmsg) * 2) + 2  
   cpd.lpData = @wmsg
   SendMessage(msgr, WM_COPYDATA, 0, @cpd)
End Sub

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