nielsie95
2010-06-28 09:00:08
Hey there,
I'm not sure if I've seen this before, but I'll post it anyway. Here's how to show a script's status through MSN (Live) Messenger:
This only works if the user has the option enabled to show the current song that is playing. It should work in both SCAR (API Calls enabled) and Simba. I'm not sure with which MSN versions it works. I have v14 and it works for me. If it works/doesn't work for you, could you post the version? :)
~Nielsie95
I'm not sure if I've seen this before, but I'll post it anyway. Here's how to show a script's status through MSN (Live) Messenger:
program MSNStatus;
type
TWideCharArray = array of WideChar;
TCopyDataStruct = record
dwData: Integer;
cbData: Integer;
lpData: TWideCharArray;
end;
function FindWindow(lpClassName: string; lpWindowName: string): HWND; external 'FindWindowA@user32.dll stdcall';
function SendMessage(Wnd: HWND; msg: Cardinal; wParam: Integer; var lParam: TCopyDataStruct): Integer; external 'SendMessageA@user32.dll stdcall';
function StringToCharArray(s: widestring): TWideCharArray;
var
i, l: Integer;
begin
l := Length(s);
SetLength(Result, l + 1);
for i := l downto 1 do
Result[i - 1] := s[i];
Result[l] := #0;
end;
procedure msnStatus(sName, sStatus: widestring);
var
s: widestring;
cds: TCopyDataStruct;
msn: HWND;
begin
s := Format('\0Music\0%d\0%s\0%s\0%s\0', [1, '{0} - {1}', sName, sStatus]);
cds.dwData := $547;
cds.cbData := 2 + Length(s) * 2;
cds.lpData := StringToCharArray(s);
msn := FindWindow('MsnMsgrUIManager', '');
if (msn > 0) then
SendMessage(msn, $004A, 0, cds);
end;
begin
msnStatus('MyScript', '170 logs');
end.
This only works if the user has the option enabled to show the current song that is playing. It should work in both SCAR (API Calls enabled) and Simba. I'm not sure with which MSN versions it works. I have v14 and it works for me. If it works/doesn't work for you, could you post the version? :)
~Nielsie95