to JobsLee:
按你说的作,还是不行。我的程序如下:
unit exu1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
rasconn95=record
dwsize:dword;
hrasconn:dword;
szentryname:array[0..255] of byte;
szdevicetype:array[0..15] of byte;
szdevicename:array[0..127] of byte;
end ;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function rasenumconnections(lprasconn:rasconn95;lpcb:dword;lpcconnection:dword):dword;
function rashangup(hrasconn:dword):dword;
var
Form1: TForm1;
implementation
{$R *.DFM}
function rasenumconnections;external'rasapi32.dll' ;
function rashangup;external'rasapi32.dll' name 'rashangupw';
procedure TForm1.Button1Click(Sender: TObject);
var
lngretcode:dword;
lpcb:dword;
lpcconnections:dword;
intarraysize:integer;
intindex:integer;
intlooper:integer;
lprasconn95:array[0..256] of rasconn95;
begin
lprasconn95[0].dwsize:=412;
lpcb:=256*lprasconn95[0].dwsize;
lngretcode:=rasenumconnections(lprasconn95[0],lpcb,lpcconnections);
if lngretcode=0 then
if lpcconnections>0 then
for intlooper:=0 to lpcconnections-1 do
begin
rashangup(lprasconn95[intlooper].hrasconn);
end
else
showmessage('no connection');
end;
end.