![]() |
Msn contact list
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; |
Re: Msn contact list
Could you tell us the error message - maybe we could help you then :roll:
But obviously you are trying to use an unreferenced interface - How do you think this should work exactly? |
Re: Msn contact list
This gets contact list it just doesnt get what i want:( to get list with status.
--------------------------- Debugger Exception Notification --------------------------- Project MSNMessengerAPIController.exe raised exception class EAccessViolation with message 'Access violation at address 0047F15B in module 'MSNMessengerAPIController.exe'. Read of address 00000000'. --------------------------- Break Continue Help --------------------------- |
Re: Msn contact list
Try to debug it, so you can tell us in wich line the exception is raised
|
Re: Msn contact list
Zitat:
|
Re: Msn contact list
You access MSNMyContacts without initializing it first. Btw, you should really format your code properly.
|
Re: Msn contact list
Zitat:
|
Re: Msn contact list
Initilized but still same error and this gets me thinking :roll:
Even if i change the line order still the same error
Delphi-Quellcode:
if MSNMyContact.Status=status then BEGIN for v_Count := 0 to MSNMyContacts.Count - 1 do MSNMyContact := (MSNMyContacts.Item(v_Count) as IMessengerContact); result:= MSNMyContact.FriendlyName + ' ' +MSNMyContact.FriendlyName;
Delphi-Quellcode:
function contactslist(status:MISTATUS):string;
var MSNMessenger: IMessenger; MSNMyContacts: IMessengerContacts; MSNMyContact: IMessengerContact; v_Count: Integer; begin MSNMessenger := MessengerAPI_TLB.CoMessenger.Create; MSNMyContacts := (MSNMessenger.MyContacts as IMessengerContacts); for v_Count := 0 to MSNMyContacts.Count - 1 do begin if MSNMyContact.Status=status then BEGIN MSNMyContact := (MSNMyContacts.Item(v_Count) as IMessengerContact); result:= MSNMyContact.FriendlyName + ' ' +MSNMyContact.FriendlyName; end; end; end; |
Re: Msn contact list
If you wanna pour water out of an bottle, you have to open it first. You still evaluate an reference before you ajust it to an object!!!
|
Re: Msn contact list
MISTATUS is ToleEnum
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:52 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz