读取MSN的联系人列表
(*********************************************************************
this code was run under microsoft messenger 4.6..
not yet tested on 6.1 or 6.2
this code, show you all msn contact/allow/block user list from registry,
you know, this values type is Binary..
good luck.. if you have news please write me, thx..
written by neoturk from turkey
*********************************************************************)
//.. put the memo on the form, name as memo2 ..
function msnlist(xx: string): string;
var
x2, x, x3, xtemp: string;
reg: TRegistry;
fBuffer: array [0..1024] of Byte;
m, n: Longint;
begin
Form1.Memo2.Clear;
for n := 0 to 125 do
begin
x2 := xx + IntToStr(n);
reg := TRegistry.Create;
reg.RootKey := HKEY_CURRENT_USER;
reg.OpenKey('\Software\Microsoft\MessengerService\ListCache\.NET Messenger Service',
False);
if reg.ValueExists(x2) then
begin
reg.ReadBinaryData(x2, fBuffer, 1024);
m := 0;
x := '';
x3 := '';
repeat
xtemp := IntToHex(fbuffer[m], 2);
x := x + xtemp + ' ';
x3 := x3 + chr(StrToInt('$' + xtemp));
m := m + 1;
until m >= 1024;
Form1.Memo2.Lines.Add(x2 + '=' + x3);
//showmessage(trim(x2+'='+x3));
end;
end;
reg.CloseKey;
reg.Free;
Result := Form1.Memo2.Text;
//final
end;
// in your program:
procedure DoSomething;
begin
//...
memo5.Lines.Add('--------------');
memo5.Lines.Add(msnlist('allow'));
memo5.Lines.Add('--------------');
memo5.Lines.Add('Reverse_list:');
memo5.Lines.Add('--------------');
memo5.Lines.Add(msnlist('reverse'));
memo5.Lines.Add('--------------');
memo5.Lines.Add('Contact_list:');
memo5.Lines.Add('--------------');
memo5.Lines.Add(msnlist('contact'));
memo5.Lines.Add('--------------');
memo5.Lines.Add('Block_list:');
memo5.Lines.Add('--------------');
memo5.Lines.Add(msnlist('block'));
//......ok.
end;