import msn contact list to delphi?

Plasmax
Plasmax used Ask the Experts™
on
i just cant get this working on the new msn, it works on the old 1

anyone got any code
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;

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You need to import the messenger typelibrary (MessengerAPI_TLB)
MenuBar ->
Project -> Import Type Library
Add...
C:\Program Files\MSN Messenger\msnmsgr.exe


uses MessengerAPI_TLB;
 
procedure TForm1.ListMsnContacts(Sender: TObject);
var
  msnContacts : IMessengerContacts;
  msnContact : IMessengerContact;
  iCntdor : Integer;
begin
  msnContacts := IMessengerContacts(MessengerAPI_TLB.CoMessenger.Create.MyContacts);
 
 
  for iCntdor := 0 to msnContacts.Count - 1 do
  begin
    msnContact := IMessengerContact(msnContacts.Item(iCntdor));
    //Memo1.Lines.Add(msnContact.SigninName + ' - ' + msnContact.FriendlyName);
    Memo1.Lines.Add(msnContact.SigninName);
  end;
end;

Open in new window

Author

Commented:
good posts very interesting but not what I am looking for,

i just want to grab from the registry the current MSN contacts on my msn and show them in a basic delphi memo.
the code should only be around 5 - 30 lines, any ideas
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

But that's exactly what the above code does, except for the fact that doesn't need to read the registry.

Are you sure you want to read the registry in order to do that

Author

Commented:
just seems like a lot of code for such a small task, the links are more for running msn from a delphi program, i dont want to install anything just grab the msn stored on the comp and flash them into a memo box inside my application, for exmaple

button 1   get my msn contact lost

result, my contact lists shown in a memo lext to button 1.

any ideas

Author

Commented:
again code to old, all the locations have changed.

Author

Commented:
hey i added your code, i never even seen that,  but i get error on: MessengerAPI_TLB.dcu

i installed what you said, but I had to go to windowslive/messenger/msnmsgr.exe
Put the MessengerAPI_TLB.pas in your project's folder and try this

unit uMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
  private
    procedure ListMsnContacts;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;



implementation

uses MessengerAPI_TLB;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  ListMsnContacts;
end;

procedure TForm1.ListMsnContacts;
var
  msnContacts : IMessengerContacts;
  msnContact : IMessengerContact;
  iCntdor : Integer;
begin
  msnContacts := IMessengerContacts(MessengerAPI_TLB.CoMessenger.Create.MyContacts);
  for iCntdor := 0 to msnContacts.Count - 1 do
    begin
    msnContact := IMessengerContact(msnContacts.Item(iCntdor));
    //Memo1.Lines.Add(msnContact.SigninName + ' - ' + msnContact.FriendlyName);
    Memo1.Lines.Add(msnContact.SigninName);
    end;
end;


end.

Author

Commented:
same errors, dam,
thanks anyways, I will keep on it, got any other ideas

Author

Commented:
dude yoiu have helped so much u can have points I opened a new question as I changed the way i plan to do this now,   thanks have a look at new question

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial