![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
kol skype demo
Thaddy © (2005-07-31 22:18:00)I have a beta available for skype users here:
http://www.thaddy.com/kolskype.zip
It demo's the Skype API with KOL.
Plz. test it if you use Skype!
Thaddy (2005-08-02 11:53:00) [1]For testers:
http://share.skype.com/developer_zone/documentation/api_v1.3_documentation
Contains the latest skype documentation.
The full protocol 5 should work.
Thaddy (2005-08-01 17:09:00) [2]
Here's a small demo:
{
program Project1;
uses
Kol,
Unit1 in 'Unit1.pas';
begin
NewForm1( Form1, nil);
Run(Form1.form);
end.
}
unit unit1;
interface
uses
Windows, Messages, Kol, kolskypecall;
type
PForm1=^TForm1;
TForm1=object(Tobj)
Form:pControl;
Btn:Pcontrol;
public
procedure DoKeyUp( Sender: PControl; var Key: Longint; Shift: DWORD );
end;
procedure NewForm1( var Result: PForm1; AParent: PControl );
var
Form1:pForm1;
implementation
procedure NewForm1( var Result: PForm1; AParent: PControl );
begin
New(Result,Create);
with Result^ do
begin
Form:= NewForm(AParent,'KOL Skype Call Demo').SetSize(300,100).centeronparent.Tabulate;
form.Font.ReleaseHandle;
form.Font.assignhandle(getstockobject(default_gui_font));
Applet:=Form;
Form.Add2AutoFree(Result);
NewLabel(Form,'Enter Skype contact:').SetAlign(caTop);
Btn:=NewEditbox(form, []).setalign(caTop).resizeparent;
btn.OnKeyUp:=DoKeyUp;
btn.Text:='echo123';
btn.selstart:=length(btn.Text);
btn.Color:=clWindow;
form.simplestatustext:='';
end;
end;
procedure Tform1.DoKeyUp( Sender: PControl; var Key: Longint; Shift: DWORD );
begin
if Key = 13 then
begin
CallSkype(btn.Text);
Key := 0
end
end;
end.
And here's a simple unit to make a call in a single line:
unit kolskypecall;
{
Title : KolSkypeCall
Author : Thaddy de Koning
Date : July 31, 2005
Terms : Copyrighted freeware © 2005
Delphi Version: 4,5,6,7, 2005
Third Party Required: objects.pas, kolregistry
Description:
Make a Skype call with a single routine.
Based on sourcecode by Bob Swart (a.k.a. drBob) for The Delphi Magazine 120.
}
interface
// Simply call this with the skype CallID, like:
// CallSkype('thaddydekoning');
procedure CallSkype(const CallID: String);
implementation
uses
windows, messages, kol, objects, KolRegistry;
type
PSkypeConnection = ^TSkypeConnection;
TSkypeConnection = object(TObj)
private
FHandle:HWnd;
SkypeControlAPIAttach: DWord;
SkypeControlAPIDiscover: DWord;
SkypeAPIWindowHandle: Integer;
FCallId:String;
protected
procedure WindowHook(var Msg: TMessage);
procedure SendMessageToSkype(Str: String);
public
destructor destroy;virtual;
property CallID: String read FCallID write FCallID;
property Handle:Hwnd read FHandle;
end;
// Make it a singleton!
var
SkypeConnection: PSkypeConnection = nil;
function SkypeClient: String;
var
Reg: PRegistry;
begin
Result := '';
Reg := NewRegistry(KEY_READ);
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('SOFTWARE\Skype\Phone', False) then
Result := Reg.ReadString('SkypePath')
finally
Reg.Free;
end
end;
function NewSkypeConnection(aCallID: String):PSkypeConnection;
begin
Result:=nil;
if SkypeClient = '' then exit;
New(Result,Create);
with Result^ do
begin
Fhandle:=AllocateHwnd(WindowHook);
FCallID := aCallID;
SkypeControlAPIAttach := RegisterWindowMessage('SkypeControlAPIAttach');
SkypeControlAPIDiscover := RegisterWindowMessage('SkypeControlAPIDiscover');
PostMessage(HWND_BROADCAST, SkypeControlAPIDiscover, FHandle, 0);
Applet.Add2autofree(Result);
end;
end;
procedure CallSkype(const CallID: String);
begin
if not Assigned(SkypeConnection) then
SkypeConnection := NewSkypeConnection(CallID)
else
SkypeConnection.SendMessageToSkype('CALL ' + CallID)
end;
{ TSkypeConnection }
destructor TSkypeConnection.destroy;
begin
if FHandle <> 0 then
DeAllocateHwnd(Fhandle);
inherited;
end;
procedure TSkypeConnection.SendMessageToSkype(Str: String);
var
CopyData: CopyDataStruct;
begin
if Str <> '' then
begin
CopyData.dwData := 0;
CopyData.lpData := PChar(Str);
CopyData.cbData := Length(Str)+1;
SendMessage(SkypeAPIWindowHandle, WM_COPYDATA, FHandle,
LPARAM(@CopyData))
end
end;
procedure TSkypeConnection.WindowHook(var Msg: TMessage);
begin
if Msg.Msg = SkypeControlAPIAttach then
begin
if Msg.LParam = 0 then
begin
SkypeAPIWindowHandle := Msg.WParam;
SendMessageToSkype('CALL ' + CallID)
end;
Msg.Result := 1
end
else
if Msg.WParam = SkypeAPIWindowHandle then Msg.Result := 1;
end;
end.
KolRegistry.pas or KolExregistry.pas is available from my website.
More to follow soon!
Thaddy (2005-08-01 13:40:00) [3]Try to skype me with handle "thaddydekoning", and you should get my answering machine!
ECM (2005-08-01 13:28:00) [4]Has started - like works. :)