faqts : Computers : Programming : Languages : Delphi : Database

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 9 people (56%) answered Yes
Recently 5 of 9 people (56%) answered Yes

Entry

Delphi: Database: Telephone: Can you give an outline of searching in telephone database + dialing?

Aug 29th, 2003 11:27
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 24 August 2003 - 10:23 pm ---------------------

Delphi: Database: Telephone: Can you give an outline of searching in 
telephone database + dialing?

Steps: Overview:

 1. -Create a database with 1 primary key field
     on the name, and minimal 2 columns

       NameS                 A   255   *

       TelephonenumberS      A   255

http://www.faqts.com/knowledge_base/view.phtml/aid/23856/fid/175

 2. -Use e.g. a data aware edit box (that is you can get the data
     directly out of the database) to get the telephone number

     From palette 'Data controls', take a DBEdit, and make a connection
     to the datasource.

     Then connect it to the column of the telephonenumber in your
     database.

 3. Put an edit box on your form, in which you fill in your search
    string (e.g. 'Debra')

 4. -Put a button on the form, and fill in code similar to this:

   table1.IndexFieldNames := 'NameS';
   Table1.IndexName := 'NameS';
   Table1.SetKey;
   if Table1.FindKey( [ 'Debra' ] ) then begin
    // do something
    ShowMessage( 'Debra' + ': found' );
   end;

 The data aware editbox should show the connected telephone number

 5. -To dial a telephone number, you can e.g. send Hayes compatible
     modem commands to your modem. So you dial your telephone number
     via your modem.

     So what you do is you take the telephone cable, and plug this
     in the telephone connection of your modem (similar as when
     wanting to send a fax, using your modem). Some modems have
     a headphone connection, so you can speak and so have a telephone
     conversation via the modem.

     ---

     I used once a command similar to the one below to send
     an MSDOS command to standard output.

      'echo atd' + telephonenumberS + ' > com1'

     ---

     For example, if the telephone number is

       1-800-800

     and if you have your modem connected to the telephone
     line, and you type this command on the MSDOS command line:

       echo atd1800800 > com1

     (here the 'd' stands for 'd'ial)
     it should make the connection with that telephone number
     for you.

     ---

     To run this command, and to dial your telephone number from
     Delphi, you can then use something like:

      // put ShellApi in your 'uses' clause

      ShellExecute( 0, 'open', Pchar( 'command.com' ), Pchar( '/c' 
+ ' ' + 'echo atd' + telephonenumberS + ' > com1' ), nil, SW_SHOW );


----------------------------------------------------------------------