AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Msn contact list

Ein Thema von Razor · begonnen am 27. Jan 2009 · letzter Beitrag vom 29. Jan 2009
Thema geschlossen
Seite 1 von 4  1 23     Letzte »    
Razor
(Gast)

n/a Beiträge
 
#1

Msn contact list

  Alt 27. Jan 2009, 20:12
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;
 
Benutzerbild von Meflin
Meflin

Registriert seit: 21. Aug 2003
4.856 Beiträge
 
#2

Re: Msn contact list

  Alt 27. Jan 2009, 20:15
Could you tell us the error message - maybe we could help you then

But obviously you are trying to use an unreferenced interface - How do you think this should work exactly?
 
Razor
(Gast)

n/a Beiträge
 
#3

Re: Msn contact list

  Alt 27. Jan 2009, 20:16
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
---------------------------
 
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.861 Beiträge
 
Delphi 11 Alexandria
 
#4

Re: Msn contact list

  Alt 27. Jan 2009, 20:19
Try to debug it, so you can tell us in wich line the exception is raised
Markus Kinzler
 
Razor
(Gast)

n/a Beiträge
 
#5

Re: Msn contact list

  Alt 27. Jan 2009, 20:19
Zitat von mkinzler:
Try to debug it, so you can tell us in wich line the exception is raised
if MSNMyContact.Status=status then // <<< compiler shows error here!!!
 
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#6

Re: Msn contact list

  Alt 27. Jan 2009, 20:22
You access MSNMyContacts without initializing it first. Btw, you should really format your code properly.
 
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.861 Beiträge
 
Delphi 11 Alexandria
 
#7

Re: Msn contact list

  Alt 27. Jan 2009, 20:24
Zitat:
Delphi-Quellcode:
if MSNMyContact.Status=status then // <<< compiler shows error here!!!

    MSNMyContact := (MSNMyContacts.Item(v_Count) as IMessengerContact);
   result:= MSNMyContact.FriendlyName + ' ' +MSNMyContact.FriendlyName;
You only can evaluate the reference after assigning an object to it. Maybe you have to change the order
Markus Kinzler
 
Razor
(Gast)

n/a Beiträge
 
#8

Re: Msn contact list

  Alt 27. Jan 2009, 20:25
Initilized but still same error and this gets me thinking


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;
 
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.861 Beiträge
 
Delphi 11 Alexandria
 
#9

Re: Msn contact list

  Alt 27. Jan 2009, 20:29
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!!!
Markus Kinzler
 
Razor
(Gast)

n/a Beiträge
 
#10

Re: Msn contact list

  Alt 27. Jan 2009, 20:31
MISTATUS is ToleEnum
 
Thema geschlossen
Seite 1 von 4  1 23     Letzte »    


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:24 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz