网络拨号中每个“连接”的名字: RasEnumConnections/RasEnumEntries
下面摘自我的“中国网爪”软件中
{*****************************************************************}
{ Ras Declare }
const
RAS_MaxEntryName = 256;
RAS_MaxDeviceName = 128;
RAS_MaxDeviceType = 16;
type
PHRASConn = ^HRASConn;
HRASConn = DWORD;
PRASConn = ^TRASConn;
TRASConn = record
dwSize: DWORD;
rasConn: HRASConn;
szEntryName: array [0..RAS_MaxEntryName] Of Char;
szDeviceType : array [0..RAS_MaxDeviceType] Of Char;
szDeviceName : array [0..RAS_MaxDeviceName] of char;
end;
function RasHangUp( RASConn: HRasConn): LongInt;
stdcall; external 'rasapi32.dll' name 'RasHangUpA';
function RasEnumConnections( var RASConn: TRasConn;
var BufSize: DWord; var Connections: DWord ): LongInt;
stdcall; external 'rasapi32.dll' name 'RasEnumConnectionsA';
{*****************************************************************}
function AutoDial(TryTimes: integer; hwnd: THandle): Boolean;
begin
Result:= False;
if InternetAutodial(
INTERNET_AUTODIAL_FORCE_ONLINE
//INTERNET_AUTODIAL_FORCE_UNATTENDED
,hwnd) then Result:= True;
end;
function AutoDialHangUp: Boolean;
//const MaxConnections = 10;
var
RasConn : TRASCONN;
longSize, Actives: DWord;
begin
// Result:= InternetAutodialHangup(0);
Actives:= 0;
RasConn.dwSize := sizeof(TRASConn);
longSize := RasConn.dwSize;
Result:= RasEnumConnections(RasConn,longSize,Actives)=0;
if Result then Result:= RasHangUp(RasConn.RasConn)=0;
end;