BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dialing a phone number

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Morosh
Guest





PostPosted: Thu Sep 07, 2006 6:10 pm    Post subject: dialing a phone number Reply with quote



Hello:

I like to dial a phone number in C++, is it possible??
thanks
Maurice
Back to top
Eangelo
Guest





PostPosted: Thu Sep 07, 2006 8:06 pm    Post subject: Re: dialing a phone number Reply with quote



If you are using a standard modem, basically you have to open the COM port
to which the modem is connected, then to issue the following AT commands
(<CR> is the character 0xD, 13 decimal):

ATZ<CR>

wait for "OK" from the modem and then:

ATDT 0123456789;<CR>

Don't forget the character ";" (semicolon) after the number to dial,
otherwise the modem will try to connect in "data mode"

To terminate the call:

AT H0<CR>

Henry


"Morosh" <morisaab (AT) yahoo (DOT) fr> ha scritto nel messaggio
news:450019d6 (AT) newsgroups (DOT) borland.com...
Quote:
Hello:

I like to dial a phone number in C++, is it possible??
thanks
Maurice


Back to top
Hans Galema
Guest





PostPosted: Thu Sep 07, 2006 8:39 pm    Post subject: Re: dialing a phone number Reply with quote



Morosh wrote:

Quote:
I like to dial a phone number in C++, is it possible??

Have a look at tapiRequestMakeCall().

Hans.
Back to top
Morosh
Guest





PostPosted: Sat Sep 09, 2006 6:43 pm    Post subject: Re: dialing a phone number Reply with quote

"Eangelo" <eangelo (AT) libero (DOT) it> wrote in message
news:45003577$1 (AT) newsgroups (DOT) borland.com...
Quote:
If you are using a standard modem, basically you have to open the COM port
to which the modem is connected, then to issue the following AT commands
(<CR> is the character 0xD, 13 decimal):

ATZ<CR

wait for "OK" from the modem and then:

ATDT 0123456789;<CR

Don't forget the character ";" (semicolon) after the number to dial,
otherwise the modem will try to connect in "data mode"

To terminate the call:

AT H0<CR

Henry


"Morosh" <morisaab (AT) yahoo (DOT) fr> ha scritto nel messaggio
news:450019d6 (AT) newsgroups (DOT) borland.com...
Hello:

I like to dial a phone number in C++, is it possible??
thanks
Maurice






Hi:
I have two modems: one internal connected to com3, and one usb external
connected to com4
(information from Device Manager)
I tried the following:

#include "stdio.h"
#include "bios.h"

void main()
{
int x;

FILE* comport;

if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");
else
{
fputs("ATDT01555444333\n",comport);
}
if(comport) fclose(comport);
}

I compiled and the response is:

COM3 not open.: No such file or directory

(I tried both "com3" and "com3:" ), the same thing happens to com4

any idea??
thanks
Maurice
Back to top
Bob Gonder
Guest





PostPosted: Sun Sep 10, 2006 7:51 pm    Post subject: Re: dialing a phone number Reply with quote

Morosh wrote:

Quote:
I have two modems: one internal connected to com3, and one usb external
connected to com4

if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");

COM3 not open.: No such file or directory

(I tried both "com3" and "com3:" ), the same thing happens to com4

"COM3" is correct

You might try using
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};
Back to top
Morosh
Guest





PostPosted: Tue Sep 12, 2006 8:10 am    Post subject: Re: dialing a phone number Reply with quote

"Bob Gonder" <notbg (AT) notmindspring (DOT) invalid> wrote in message
news:in88g21pd7ivvo44c2no7a54kl7ii2sic0 (AT) 4ax (DOT) com...
Quote:
Morosh wrote:

I have two modems: one internal connected to com3, and one usb external
connected to com4

if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");

COM3 not open.: No such file or directory

(I tried both "com3" and "com3:" ), the same thing happens to com4

"COM3" is correct

You might try using
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};



Hello:
thanks for clarifications
But which header file should be included in the beginning?
I tried "io.h", it didn't work.
I use always the free command line compiler.
that's what I've tried:

*******************************************
#include "stdio.h"
#include "io.h"
void main()
{
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};
}

Thanks
Maurice
Back to top
Bob Gonder
Guest





PostPosted: Tue Sep 12, 2006 10:36 pm    Post subject: Re: dialing a phone number Reply with quote

Morosh wrote:

Quote:
But which header file should be included in the beginning?

We are in the .nativeapi group.
Those functions are native Windows API functions.
The vast majority of Windows functions are available by including
windows.h.

#include <windows.h>

The headers for those that are not included by windows.h may be found
by looking at the documentation for the functions. MSDN is esspecially
good at that. http://msdn.microsoft.com/library/
Back to top
Maurice
Guest





PostPosted: Thu Sep 14, 2006 3:12 pm    Post subject: Re: dialing a phone number Reply with quote

"Bob Gonder" <notbg (AT) notmindspring (DOT) invalid> wrote in message
news:5hrdg2djn4a8onsagqjb7nr2mnjuqqkneq (AT) 4ax (DOT) com...
Quote:
Morosh wrote:

But which header file should be included in the beginning?

We are in the .nativeapi group.
Those functions are native Windows API functions.
The vast majority of Windows functions are available by including
windows.h.

#include <windows.h

The headers for those that are not included by windows.h may be found
by looking at the documentation for the functions. MSDN is esspecially
good at that. http://msdn.microsoft.com/library/




Thanks very much, it worked!!!!!!!!!!!!


Now, if you had time, I like to read the modem status to know if the ligne
is busy or not.

Any idea???

Thanks again
Maurice
Back to top
Bob Gonder
Guest





PostPosted: Thu Sep 14, 2006 10:02 pm    Post subject: Re: dialing a phone number Reply with quote

Maurice wrote:

Quote:
Now, if you had time, I like to read the modem status to know if the ligne
is busy or not.

Any idea???

After WriteFile() do a ReadFile() to read the response.

You would probably want to read single chars and build up a response
out of them because you don't know the size of the response ahead of
time.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.