2

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

在我的表单创建中,我创建了通信器对象,并将我的联系人列表加载到 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 }
4

0 回答 0