在Delphi代码中使用OnContactStatusChange与Microsoft Communicator 2007交互

时间:2012-04-17 19:47:50

标签: delphi office-communicator msn-messenger

这是我想要做的。我希望在列表中的联系人更改Microsoft Communicator 2007中的状态时收到通知。我正在使用Windows 7运行Delphi XE。

在我的表单创建中,我创建了communicator对象,并将我的联系人列表加载到TListBox中。我在CommunicatorAPI_TLB中看到,有一个名为:

的方法
  DMessengerEvents = dispinterface
...
    procedure OnContactStatusChange (const pMContact: IDispatch; mStatus: MISTATUS); dispid 1030;

认为这是我想要使用的那个。我如何在代码中集成它?

{ Create the communicator object, it's already up and running }
COMMUNICATOR := CoMessenger.Create;

{ Load my contacts into a listbox; do NOT use Hard Typecasts }
Contacts := COMMUNICATOR.MyContacts As IMessengerContacts;

For ContactIndex := 0 To (Contacts.Count - 1) Do Begin

  Application.ProcessMessages;

  Contact := (Contacts.Item (ContactIndex) As IMessengerContact);

  { Add the contact to the list }
  lstContacts.AddItem (Contact.FriendlyName, Nil);

 End; { For }

0 个答案:

没有答案