Help - Search - Members - Calendar
Full Version: Do we have any Delphi Developer in this forum?
Skype Community > English > Development, Betas and Skype Garage > Skype Public API
bjarnewinkler_
I will be happy to swap code with other Delphi developers, assuming that we have other on this forum, and someone that is willing to share.

I have done a SkypeAPI.Pas file with a SkypeAPI Class. However since I have just started I need to do more, and a group could speed up the base development. Current status: The frame work is in place and working under D7.

After the SkypeAPI Class is in place then it would be easy to create DLL's or COM modules. However I assume we really need to get it in under .Net ( D8 ).
bjarnewinkler_
Hello Bjarne,
I was glad to hear somebody talk about Delphi. I program in Delphi and would be interested in helping out in building the API. I probably don't have the depth that you have but may be of some use

Look forward to hearing from you

Charles
bjarnewinkler_
Charles,

This is great, we are now two Delphi developers on the forum.

What I have been able to do so far is create a sample program that can "talk" to Skype, meaning sending commands to Skype and getting answers back from skype.

What we need to do is create a real good class that we can have in a Delphi Unit PAS file so it can be linked into any Delphi application that need Skype activities.

I am traveling the next couple of day but will over the weekend publicize some code and then maybe we can get a little Delphi group together for not only adding more code but also do some testing to ensure that this is just working.

Later....
bjarnewinkler_
Hello bjarne,
Great to hear that you already have the API working. Building a class on tope of it should be straightforward. I'm assuming you will want to create one function per type of call to the Skype API. Since it is broadcast mode, what would be the best way to handle multiple function calls? Will we need a sort of query manager that will only send one command at a time to the Skype API and wait for a response before sending another one? I guess another way would be to put the queries in a list as you send them out and depending on the response you get back, you can figure out which query it's answering? This sounds more complicated and risky though.

I'm anxious to hear how you think the best way is to do it. Maybe there is a simpler way to do it that I'm not thinking of.

Anyway, have safe travels and I will look forward to next week when you get back.

Charles
bjarnewinkler_
Charles,

I have posted our emails on the forum for other to see, I hope that is OK with you? The reason is that I would like to share the information with others in the hope that we may get other Delphi Developers to add more to the project. If it is OK with you lets try to keep the conversations on the forum and not via the forums email that is more private.

My thinking was to build an infrastructure starting with the simple four items; Ensure that Skype is loaded when "we" need Skype, Make the handshake between us and Skype, Send a Command to Skype and Receive Response or notification from Skype. I believe I have more or less already done this part – It needs to be tested and I am sure that it can be tuned too.

On top of the infrastructure we would need to implement each of the interfaces into a set of Methods, let’s call them low level Methods.

From here we can create high level Methods that is build on grouping the low level Methods together.

With this is place we have options: Create a Delphi Skype Component, Create a Delphi DLL that can be called from any language, Create a COM module that can be embedded into any script or language program and then I would like to find a way that we can get it in under Delphi 8 (the dot net version).

Again I will post some code over the weekend.
bjarnewinkler_
Sounds good.
I will post all my responses on the forums from this point on.
Charles
bjarnewinkler_
Guys, we have posted "real" Delphi code under the heading "DELPHI" in the SkypeAPI forum if you should be interested to see how Delphi could be interfaced to Skype.

http://forum.skype.com/bb/viewtopic.php?t=4765
tomaten_
Here the simplest test application for Delphi developer:

CODE


unit skt;



interface



uses

 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

 StdCtrls;



type

 PCopyDataStruct = ^TCopyDataStruct;

 TCopyDataStruct = record

   dwData: LongInt;

   cbData: LongInt;

   lpData: Pointer;

 end;



 TfrmSkypeTest = class(TForm)

   Memo1: TMemo;

   Edit1: TEdit;

   Button1: TButton;

   procedure Button1Click(Sender: TObject);

   procedure WndProc(var msg: TMessage); override;

   procedure WMCopyData(var msg: TMessage); message WM_COPYDATA;

   procedure FormShow(Sender: TObject);

 private

   hSkype: THandle;

   WM_SkypeMessageID: Cardinal;

   function SendMessageToSkype(TheMessage: string): boolean;

 public

 end;



const

 WM_SKYPEAPI = 'SkypeControlAPI';



var

 frmSkypeTest: TfrmSkypeTest;



implementation



{$R *.DFM}



procedure TfrmSkypeTest.WndProc(var msg: TMessage);

begin

   // if Message from Skype, then set Skypes windows handle

   if msg.Msg <> WM_SkypeMessageID then

       inherited WndProc(msg)

   else

   begin

       msg.Result := 1;

       hSkype := msg.WParam;

   end;

end;



procedure TfrmSkypeTest.WMCopyData(var msg: TMessage);

begin

   msg.Result := 1;



   // Show data from Skype

   Memo1.Lines.Add('Skype Data: ' + PChar(PCopyDataStruct(msg.LParam)^.lpData));

end;



function TfrmSkypeTest.SendMessageToSkype(TheMessage: string): boolean;



var

 data : PChar;

 cds : TCopyDataStruct;



begin

   // Check for Messageregistration

   if WM_SkypeMessageID = 0 then

       Result := False

   else

   begin

       // Skype alive

       hSkype := 0;

       if SendMessage(HWND_BROADCAST, WM_SkypeMessageID, Handle, 0) = 0 then

           Result := False

       else

       begin

           // Send Message

           if hSkype = 0 then

               Result := False

           else

           begin

               data := PChar(TheMessage);

               cds.dwData := 0;

               cds.lpData := data;

               cds.cbData := StrLen(data) + 1;

               Result := SendMessage(hSkype, WM_COPYDATA, Handle, DWORD(@cds)) <> 0;

           end;

       end;

   end;

end;



procedure TfrmSkypeTest.Button1Click(Sender: TObject);

begin

   // Send Message from Editbox

   if not SendMessageToSkype(Edit1.Text) then

       Memo1.Lines.Add('Send Error.');

end;



procedure TfrmSkypeTest.FormShow(Sender: TObject);

begin

   // Register skype message

   WM_SkypeMessageID := RegisterWindowMessage(WM_SKYPEAPI);

end;



end.

digital2life_
Come on!!! It is not simple. I use Delphi to make programs as well. Here is the real simple way to use skype in Delphi. Go to Project, Import Type Library. There, you will see in the list the Skyp API. If not, you can point to the skype directory and then Install.
That is it! A new grupo of components will be shown in the palete and so, you just need to put the component and play.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, SKYPE4COMLib_TLB, OleServer, OleCtrls;

type
TForm1 = class(TForm)
Skype1: TSkype;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
Var
User : String;
begin
User := 'lucasdanielbr'; //That is me!
Skype1.PlaceCall(User,'','','');
end;

end.
ppmotskula
Good work, Bjarne!

Please consider creating a project page at https://developer.skype.com/wiki/CommunityProjects. You can also upload your code (both binary and source) there, and if you want or need, we could create a project for you in Jira, our issue tracker.
jbond
I agree the easiest way to interface with Skype from Delphi is via Skype4Com. But there is an attraction in a native Delphi component due to the smaller code size and easier shipping.

There was actually a native component but it stopped being developed between Protocol3 and Protocol4. Last updated 29-Mar-2005 15:56

See http://forum.skype.com/viewtopic.php?t=15339
http://www.sokratez.de/downloads/skypecontrol.rar

It might be sensible to start with that and take over development.
gambit47_
QUOTE(bjarnewinkler)
I will be happy to swap code with other Delphi developers, assuming that we have other on this forum, and someone that is willing to share.

I have done a SkypeAPI.Pas file with a SkypeAPI Class.  However since I have just started I need to do more, and a group could speed up the base development.  Current status: The frame work is in place and working under D7.


I am primarily a C++Builder user, but I have experience with Delphi as well. In fact, if anyone here recognizes my screenname, yes I am the same Gambit that is a member of TeamB.

I've recently completed a project that interacts with Skype using C++, and am currently working on a second project that uses Delphi. To simply development, I already wrote some classes for handling Skype events that both projects use. The main class wraps the connection to Skype and provides access to the contacts list. The second class derives from it to wrap the Ap2Ap API. The classes are written in Delphi so that both languages can share it.
digital2life_
Hi,

I can place calls using the command: Skype1.PlaceCall('User,'','',''). The problem is when I try to Finish that Call.

When I try, it asks for a ID.

How to End a Call using Delphi API??? Please!!...

Thank you.
gambit47_
QUOTE(digital2life)
I can place calls using the command: Skype1.PlaceCall('User,'','',''). The problem is when I try to Finish that Call.


If you read the Skype4COM documentation, PlaceCall() returns an ICall interface pointer. ICall has a Finish() method. For example (untested):

CODE


 var

   Call: ICall;

 begin

   if Skype1.PlaceCall('User', '', '', '', Call) = 0 then

   try

     // ...

   finally

     Call.Finish;

   end;

 end;



Alternatively, depending on how Delphi generates the TLB wrappers:

CODE


 var

   Call: ICall;

 begin

   Call := Skype1.PlaceCall('User', '', '', '');

   try

     // ...

   finally

     Call.Finish;

   end;

 end;



Or:

CODE


 var

   Call: ICall;

 begin

   Call := Skype1.PlaceCall('User');

   try

     // ...

   finally

     Call.Finish;

   end;

 end;

digital2life_
Thank you very much! I got it now. [/quote]
digital2life_
What about answering a call in Delphi?

Thanks.
tomaten
QUOTE(digital2life @ Tue Jul 18 2006, 07:21) [snapback]275745[/snapback]

Come on!!! It is not simple. I use Delphi to make programs as well. Here is the real simple way to use skype in Delphi. Go to Project, Import Type Library. There, you will see in the list the Skyp API. If not, you can point to the skype directory and then Install.
That is it! A new grupo of components will be shown in the palete and so, you just need to put the component and play.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, SKYPE4COMLib_TLB, OleServer, OleCtrls;
type
TForm1 = class(TForm)
Skype1: TSkype;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
Var
User : String;
begin
User := 'lucasdanielbr'; //That is me!
Skype1.PlaceCall(User,'','','');
end;
end.


giggle.png You joker! Look times on the date! There was not to be thought of Skype4COM yet!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.