Solved

Hanging up Dial-up networking

Posted on 1998-10-10
8
345 Views
Last Modified: 2010-04-06
Outlook Express has that checkbox "Hang up when finished" that disconnects dial-up networking. How to do that in a delphi 4 application?

I need a delphi-native source code to do that. I can't add 3rd party components or dlls to my application.
0
Comment
Question by:acerola
8 Comments
 
LVL 4

Expert Comment

by:dwwang
ID: 1342503
If you want to dial through your application, it's simple enough.
You can use the RAS component to dial/hang-up/select ras entry/...  It's pure native delphi code, utilizing windows RAS
function.

You can download it from many sites, or give me your e-mail and I mail it to you, a very small component with good function.

But if you want to hang up an existing dial-up networking
connection that brought up by other applications, I'm sorry I
don't know yet.
0
 
LVL 1

Expert Comment

by:venks
ID: 1342504
When ever any connection is through windows provide a tray icon
with a disconnect button.This can be used for all applications.
You dont have to write an application for this.
But if you have to connect and disconnect through a delphi application(like I do) give me your e mail address and i will send you two free components which will do the trick.The components are not written by me but are availble in the various delphi sites
I have answered similar questions and you can get the question from list of questions answered in the delphi experts exchange forum itself.
do not grant me any points because i have already been awarded points previously.
venks
0
 
LVL 1

Author Comment

by:acerola
ID: 1342505
I want to hang up a dial-up connection that was estabilished by using the dial-up networking. And I must not use any other components. I guess that there is a hang-up proc/func in rnaapp.dll. Couldn't I just call it? If so, how?

Once again, I want some source code, NOT some new components. I thougt that doing this took only a couple lines of code...
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 1

Expert Comment

by:EmmDieh
ID: 1342506
This may be a good starting point to you:
First retrieve the open connection(s), and then hang up
with the handle you got.
I had to write this because sometime (under Win95 NOT 98)
the Explorer crashed/restarted emptying the tray leaving
me without a possibilty to close my dial-up connection.

function RasHangUp(RASCONN: HRASCONN): DWORD; stdcall;


function HangUpRAS: Integer;
const
  MaxConnections = 16;
var
  RAS: array[1..MaxConnections] of TRASCONN;
  BuffSize: DWORD;
  CONNSWritten: DWORD;
  i: Integer;
  Ret: DWORD;
begin
  Result := 0;
    { retrieve the number of Connections }
  RAS[1].dwSize := SizeOf(RAS[1]);
  BUFFSize := SizeOf(RAS);
  CONNSWritten := 0;
  Ret := RasEnumConnections(@RAS, BUFFSize, CONNSWritten);

  if (Ret = 0) or (Ret = ERROR_BUFFER_TOO_SMALL) then
    for i := 1 to CONNSWritten do
    begin
      if RashangUp(RAS[i].hrasconn) = 0 then Inc(Result);
    end;
end;

0
 
LVL 1

Author Comment

by:acerola
ID: 1342507
Please post the definitions of the structures (TRASCONN, HRASCONN, etc). Or tell me where to find them. Also, will I need any other file besides rasapi32.dll?

Shouldn't result:=0 be ret:=0?
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1342508
You can find all the structures along with the procedure declarations in the D_RAS library. Even though you don't want it, this packagde also include a very comprehensive demo program to show (almost) all the RAS functions.
Check http://www.torry.ru/vcl/comms/d_ras.zip
0
 
LVL 1

Author Comment

by:acerola
ID: 1342509
Thank you all.
The points will go to EmmDieh, so please post something as answer.
0
 
LVL 1

Accepted Solution

by:
EmmDieh earned 50 total points
ID: 1342510
Thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 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