Titelanzeige im MSN Messenger Status:
Folgender Code ist dafür da, um den MSN Messenger Status zu ändern. Ist besonders dann praktisch, wenn man sich einen Player, etc. zusammenbastelt. Da ich das bei MSN bisschen unpraktisch fand, hab ich den Artisten mit dem Track getauscht, damit am Ende da steht: Artist - Titel!
[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SendMessageA")]
private static extern int SendMessage(int Hwnd, int wMsg, int wParam, int lParam);
[System.Runtime.InteropServices.DllImport("user32", EntryPoint = "FindWindowExA")]
private static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);
private const short WM_COPYDATA = 74;
public struct COPYDATASTRUCT
{
public int dwData;
public int cbData;
public int lpData;
}
public int VarPtr(object e)
{
System.Runtime.InteropServices.GCHandle GC = System.Runtime.InteropServices.GCHandle.Alloc(e, System.Runtime.InteropServices.GCHandleType.Pinned);
int gc = GC.AddrOfPinnedObject().ToInt32();
GC.Free();
return gc;
}
public void SetMessengerTrack(String artist, String title)
{
COPYDATASTRUCT theData;
int hMSGRUI = 0;
string buffer = "\\0Music\\01\\0";
buffer += "{0} - {1}";
buffer += "\\0";
buffer += artist; // TITEL
buffer += "\\0";
buffer += title; // ARTIST
buffer += "\\0";
buffer += ""; // ALBUM
buffer += "\\0";
buffer += "";
buffer += "\\0\\0";
theData.dwData = 0x0547;
theData.lpData = VarPtr(buffer);
theData.cbData = (buffer.Length * 2) + 2;
do
{
hMSGRUI = FindWindowEx(0, hMSGRUI, "MsnMsgrUIManager", null);
if ((hMSGRUI > 0))
{
SendMessage(hMSGRUI, WM_COPYDATA, 0, VarPtr(theData));
}
}
while (!((hMSGRUI == 0)));
}
Schlagwörter: MSN, Windows Live Messenger, Messenger, MSN Send Message
hallo djCalypso,
Warum brauchst Du nicht die offizielle Schnittstelle für den Live Messenger von Microsoft? Würde die Komplexität etwas nehmen.
Nur so als Tipp.
Beispiellink : http://www.codeproject.com/KB/cs/WindowsLiveMessengerAddin.aspx
Gruss, PRO