Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to hang up the phone?

Posted on 1999-07-16
7
Medium Priority
?
184 Views
Last Modified: 2010-04-06
Hello,
After doing some actions, I want to hang up the phone so as to disconnect the internet conenction.  How can I do so under the following conditions?
1.  The RAS name is not known
2.  D2
3.  Win95

Thanks!
0
Comment
Question by:yingkit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 30 total points
ID: 1389041
hi,
just add ras to the uses section(if you have a ras header file if not i send you one) although it sounds as though you do have one.

procedure TForm1.Button1Click(Sender: TObject);
//add  "Ras"  to the uses section:
var
  RasConn  : TRasConn;
  bsize    : DWORD;
  Count    :  DWORD;

begin
  RasConn.dwSize := SizeOf(TRasConn);
  bsize := SizeOf(RASConn);
  if RASEnumConnections(@RASConn, bsize, Count) = 0 then
     if Count > 0 then RASHangUp(RASConn.hRasConn);
end;

end;


this will hang up the active connection.
Regards Barry
0
 

Author Comment

by:yingkit
ID: 1389042
Hi Barry,
Can you please send the required header file to me?
Thx.
0
 
LVL 17

Expert Comment

by:inthe
ID: 1389043
sure  but what is email address :-)


here is file anyway:
www.delphipages.com
under Comm/Winsock section it is
8 components down from the top called rasheader V 2.11
it is not a component to install so just put in your lib directory or somewhere in you librarys path and when you need it add ras to the uses section.
Regards Barry
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:yingkit
ID: 1389044
Thanks Barry.
For D2, the two variables bsize and count have to be declared as LONGINT but not DWORD, otherwise the compiler will give you an error.
The above comment is only for D2, I dunno whether other versions would have this problem or not...so don't blame me if your version doesn't have this problem  :-)
Anyway, thanks for Barry's help!
0
 
LVL 17

Expert Comment

by:inthe
ID: 1389045
cheers YingKit
yes about the vars you are correct for d2 must be longint ,i use d4 in which case the vars are dwords.
they are also dwords in d3.

0
 
LVL 2

Expert Comment

by:mahara
ID: 1389046
the answer from inthe seems to be correct, but RASHangup should be checked for the return code when it's called.

likely to be :

  if RasHangUp(hRas) = 0 then
    begin
      // nice work :)
    end
  else
    ShowMessage('Oh god, it did not hang up!');
  end;

may seem easy but this detail is VERY important.

What if it does NOT hang up?
Return the error code to the user?
Return the extended error code to the user?
Take care of the error code(s) and do whatever you want to?
-- or, do nothing?

(Note: Use RasDialFunc or RasDialFunc1 for having more control on your RAS connection)

Never say never.


0
 
LVL 1

Expert Comment

by:plasmatek
ID: 1389047
coolio
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question