Using a Modem with Delphi2 for Win95 - PLEASE HELP ME !!!

I tried asking this question before, but no one answered, maybe , because it was worth only 210 points, so I decided to increase it to 220. If someonbe gives me a satisfactory answer.

 My porblem is the following :

   I am writing a Client/Server program in Delphi2 which uses Modem communication. The Server has a database program running  (written in Delphi also) and the Client sends queries to the server by dialing and sending bytes through the Comm Port. The server identifies the queries and answers it.
So I need the following things :
  *  How to dial a another modem
  *  How to send bytes to the other modem
  *  How to read bytes comming from the other modem
  *  How to set the Baudrate
  *  How to set the phone number
  *  How to pick up the modem
I need a component with source.
And please I need an example program with source. And please don't tell me to visit the Delphi Super Page and search for TAPI, or to visit www.Delphi32.com , because I tried those sites and they don't have what I need. Please answer as soon as you can . I am grateful for your time !
TheOneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mivCommented:
0
erajojCommented:
If you are willing to buy components then use
Async Professional 2.0 for Delphi from turbopower.
It does what you want and then some, without ANY hassle.
Otherwise; tell me (us) and I'll see what I can dig up.

/// John
0
buemohCommented:
Hallo The One,

if I 've undertand your question right, you mean, that you've to call a speciall telephonnumber, connect your modem with this modem and send a byte-stream from one modem to an other.

In my opinion, it's not important if the data is sent to a database or not.

So, I will help you to build a component, doing all this for you, because I wrote a serial component for Delphi 1.x and I'm upgrading it to Delphi 2.x. The functions of this component are basic input(output over the serial ports, therefore each baudrate may be possible and each byte-stream can be send. Including some routines from the TAPI you'll be able to call from one modem to an other and send the information as a byte-stream.

If you'll want my component for the serial input/output, please e-mail.

Bye

Hartwig

-----------------------------------------------------------
///\\\ Hartwig MOTAL ///\\\  e-mail: moh@bue.magwien.gv.at
 Weinberggasse 60/9/7, A-1190  Vienna/Austria/Europe

0
gdjCommented:
I needed a  program that dials a number, like the Windows Phone Dialer so users can return phone messages.
This isn't what you need, but hope it helps.

function ReadDialProperties : string; {Select which modem to dial from. }
var
  TelephoneINI : TIniFile;
  WindowsDir : pchar;
  DialOutCode, PhoneNumber, SubStr, CurrentLocation : string;
  Counter, StartStrPos, EndStrPos : integer;
begin
  windowsdir := '';
  GetWindowsDirectory(WindowsDir, 254);

  TelephoneINI := TIniFile.Create(StrPas(WindowsDir) + '\Telephon.Ini');
{This uses the Modems setup in Windows 95}
  CurrentLocation := TelephoneINI.ReadString('Locations', 'CurrentLocation', 'ERROR');
  if CurrentLocation <> 'ERROR' then
  begin
    StartStrPos := pos('=',CurrentLocation);
    EndStrPos := pos(',',CurrentLocation);
    CurrentLocation := TelephoneINI.ReadString('Locations', 'Location' + Copy(CurrentLocation, StartStrPos+1, EndStrPos-1), 'ERROR');
  end;
  TelephoneIni.Free;
  {Get the Local Dial Out Code}
    StartStrPos := 0;
    StartStrPos := posNext(CurrentLocation,',',StartStrPos);{Ignore the first two commas, it points the location's name}
    StartStrPos := posNext(CurrentLocation,',',StartStrPos+1);{Ignore the first two commas, it points the location's name}
    EndStrPos := posNext(CurrentLocation,',',StartStrPos+1);
    DialOutCode := Copy(CurrentLocation, StartStrPos+2, EndStrPos-StartStrPos-3);

    ReadDialProperties := DialOutCode;
end;
{**************************************************}
procedure Btn_DialClick(Sender: TObject);
var
  PhoneNumber : string;
begin
  dwDeviceID := ModemID;
  while dwDeviceID >= dwNumDevs do
  begin
    pLineDevCaps := GetDevCaps(hLineApp, dwDeviceID, dwAPIVersion);
    if (pLineDevCaps^.dwMediaModes and LINEMEDIAMODE_DATAMODEM) = 0 then
    begin
      dwDeviceID := $FFFFFFF;
    end;
  end;
  FillChar(lineCallParams, SizeOf(TLineCallParams), 0);
  lineCallParams.dwTotalSize := sizeof(TLineCallParams);
{This is were you set the params}
  lineCallParams.dwMinRate := 300;
  lineCallParams.dwMaxRate := 57600;
{The mode is were you set send/receive info}
  lineCallParams.dwMediaMode := LINEMEDIAMODE_INTERACTIVEVOICE;
  lineOpen(hLineApp, dwDeviceID, lphLine, dwAPIVersion, 0, 0, LINECALLPRIVILEGE_NONE, LINEMEDIAMODE_INTERACTIVEVOICE, @lineCallParams);
  PhoneNumber := ReadDialProperties + Text_PhoneNo.Text;
  lineMakeCall(lphLine, lphCall, PChar(PhoneNumber), 0, @lineCallParams);
  lineDrop(lphCall, nil, 0);
  lineClose(lphLine);
  lineShutdown(hLineApp);
end;

You need the unit TAPI.PAS.  I got this from Delphi.32.
If you cannot find a copy e-mail me, and I'll send it.
gdj@logicworld.com.au
0
gysbert1Commented:
If you want to go to basics, try something like this:


var
  i,
  hCom : INTEGER;
  s : string;
begin
  hCom := CreateFile('\\.\COM1', GENERIC_READ or
     GENERIC_WRITE, 0, nil, OPEN_EXISTING, 0, 0);
  // Check that hCom is valid here

  s:='atdt5551234';
  WriteFile(hCom, s[1], length(s), i, nil);
  // Written s to comport.
  // Check that i is same as length(s)
  CloseHandle(hCom);
  // Better give up the port when we're done.
end;

Similarly you can use ReadFile, and then you can do whatever you like...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.