Olá galera, nesta Quick Tips, irei mostra como podemos trabalhar com o Skype, usando ActiveX do mesmo, dentro do Delphi. Estou usando a versão do Skype 4.2.0.158, com o Delphi 2010. Continuando com o exemplo, vamos agora implementar algumas procedures dentro do nosso Formulário.

 

Declarando os métodos

 

Type

 

TFrmPrincipal = class(TForm)

   Skype1: TSkype;

   ListViewListaContato: TListView;

   EdtPesquisaContato: TLabeledEdit;

   Panel1: TPanel;

   StatusBar1: TStatusBar;

   ListViewListaLocalizarUsuario: TListView;

   ToolBar1: TToolBar;

   TlbLimparHistorico: TToolButton;

   ImageList1: TImageList;

   ListViewListaJanelasAbertas: TListView;

   TlbLocalizarUsuario: TToolButton;

private

{ Private declarations }

   procedure CarregarListaContatoSkype;

   procedure JanelasAbertas;

public

{ Public declarations }

end;

 

Implementando os métodos

 

CarregarListaContatoSkype

 

procedure TFrmPrincipal.CarregarListaContatoSkype;

Var

   U : IUserCollection;

   Usuario : IUser;

   I : Integer;

   Item : TListItem;

begin

   ListViewListaContato.Clear;

   U := Skype1.Friends;

   for I := 1 to U.Count do

   begin

      Usuario := U.Item[I];

      Item := ListViewListaContato.Items.Add;

      Item.Caption := Usuario.Handle

   end;

end;

 

JanelasAbertas

 

procedure TFrmPrincipal.JanelasAbertas;

Var

   I : Integer;

   Chat : IChatCollection;

   Item: TListItem;

begin

   Chat := Skype1.ActiveChats;

   for I := 1 to Chat.Count do

   begin

      Item := ListViewListaJanelasAbertas.Items.Add;

      Item.Caption := Chat.Item[I].FriendlyName;

   end;

end;

 

Implementando o onCreate e Usando os métodos criados

 

procedure TFrmPrincipal.FormCreate(Sender: TObject);

begin

   StatusBar1.Panels[0].Text := Skype1.CurrentUser.Handle;

   StatusBar1.Panels[1].Text := Skype1.CurrentUser.FullName;

   StatusBar1.Panels[2].Text := DateToStr(Skype1.CurrentUser.Birthday);

   StatusBar1.Panels[3].Text := Skype1.CurrentUser.Country;

   StatusBar1.Panels[4].Text := Skype1.CurrentUser.Homepage;

   StatusBar1.Panels[5].Text := Skype1.CurrentUser.Language;

   CarregarListaContatoSkype;

   JanelasAbertas;

end;

 

Fico por aqui ate à próxima Quick Tips. Veja na próxima Quick a continuação desta Série sobre ActiveX – Skype – Delphi.

 

Um abraço

 

 

Wesley Y