Merhaba
Bilgisayarda yazacağımız bir rehberden seçtiğimiz noyu arattırmak istiyoruz. bunun için bir kod yada open source component bilen varmı.
ayrıca bilgi : bilgisayara bir modem takıp telefona bağlayıp paralel yapacağız. ve bu telefon santrale bağlı...
Aslında aradığı noyu x yere bağlatmayıda becebilsek harika olurdu ama o santalin kendi içindeki şeylere müdahale etmeyi gerektiriyor galiba
bilgisayardan bir telefon no sunu arattırma
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
- White Rose
- Üye
- Mesajlar: 726
- Kayıt: 06 Tem 2005 09:41
- Konum: Güneyden
- İletişim:
Kod: Tümünü seç
unit Dialer;
interface
uses Windows,SysUtils,WinTypes,WinProcs,Messages,Classes,Graphics,Controls,
Forms, Dialogs;
type
TComPort = (dpCOM1,dpCOM2,dpCOM3,dpCOM4);
TMethod = (dmTone,dmPulse);
TDialer = class(TComponent)
private
{ Private declarations }
FComPort : TComPort;
FNumberToDial : string;
FConfirm : boolean;
FMethod : TMethod;
protected
{ Protected declarations }
public
{ Public declarations }
procedure Execute;
published
property ComPort : TComPort read FComPort
write FComPort;
property Confirm : boolean read FConfirm
write FConfirm;
property Method : TMethod read FMethod
write FMethod;
property NumberToDial : string read FNumberToDial
write FNumberToDial;
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Telefon', [TDialer]);
end;
procedure TDialer.Execute;
var
s : string;
hCommFile : THandle;
Status : LongBool;
NumberWritten : DWORD;
begin
if FConfirm then
begin
if Application.MessageBox('Telefon numarasını çeviriyorum... ','Telefonu Çevir',
32+1)=IdCancel then Exit;
end;
{Open Com Port}
s:='COM'+Chr(49+Ord(FComPort));
hCommFile:= CreateFile( PChar(s), GENERIC_WRITE,
0, {not shared}
nil, {no security ??}
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0 {template} );
if hCommFile=INVALID_HANDLE_VALUE then
begin
Application.MessageBox('Modem portu hatalı.....','Hata',+64+0);
Exit;
end;
{Create a string to send to modem}
s:='ATDT'+FNumberToDial+#13+#10;
if FMethod=dmPulse then s[4]:='P';
{Send phone number to modem}
NumberWritten:=0;
Status:=WriteFile( hCommFile,PChar(s)[0],
Length(s),
NumberWritten,
nil);
if Status then
begin
Application.MessageBox('Konuşma için ahizeyi kaldırınız'+#13+'İptal için butonu tıklayınız......','Bilgi..!',64+0);
WriteFile(hCommFile,'ATH'^M^J,5,NumberWritten,nil);
end
else
Application.MessageBox('Telefon numarası çevrilemedi.....','Hata',64+0);
{Close communication port}
CloseHandle(hCommFile);
end;
end.
compile ettiğinizde Telefon diye bir sekme açar ve dialer componentini ekler, siz de bu componenti telefon aramalarında kullanabilirsiniz, tek yapmanız gereken com portu ayarlamak.