First of all i wrote this code second of all it dosen't work as it should.Well what i want to do is that it adds only people with certain status to the list.
Delphi-Quellcode:
const
MISTATUS_UNKNOWN = $00000000;
MISTATUS_OFFLINE = $00000001;
MISTATUS_ONLINE = $00000002;
MISTATUS_INVISIBLE = $00000006;
MISTATUS_BUSY = $0000000A;
MISTATUS_BE_RIGHT_BACK = $0000000E;
MISTATUS_IDLE = $00000012;
MISTATUS_AWAY = $00000022;
MISTATUS_ON_THE_PHONE = $00000032;
MISTATUS_OUT_TO_LUNCH = $00000042;
MISTATUS_LOCAL_FINDING_SERVER = $00000100;
MISTATUS_LOCAL_CONNECTING_TO_SERVER = $00000200;
MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER = $00000300;
MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER = $00000400;
function contactslist(status:MISTATUS):string;
var
MSNMessenger: IMessenger;
MSNMyContacts: IMessengerContacts;
MSNMyContact: IMessengerContact;
v_Count: Integer;
begin
for v_Count := 0 to MSNMyContacts.Count - 1 do
begin
if MSNMyContact.Status=status then // <<< compiler shows error here!!!
MSNMyContact := (MSNMyContacts.Item(v_Count) as IMessengerContact);
result:= MSNMyContact.FriendlyName + ' ' +MSNMyContact.FriendlyName;
end;
end;
procedure TfrmMain.Button2Click(Sender: TObject);
begin
ListBox1.Items.Add(contactslist( MISTATUS_ONLINE));
end;