小问题(在线等待)
怎么样在windows2000下枚举出本地机的拨号连接?有源码最好 问题点数:50、回复次数:10Top
1 楼Alanwn(天痴(日本人与狗不得回答问题))回复于 2003-11-03 11:25:11 得分 0
怎么没有人会吗?高手都干什么去了?Top
2 楼saien(精益求精)回复于 2003-11-03 11:29:04 得分 5
获取当前系统中可用的拨号连接名称.。
在建立了拨号连接后,WIN9X将拨号连接的名称和属性写了注册表中,我们可以从注册表中可用的拨号连接名称
及InterNet Explorer中的默认连接名称。
在注册表的HKEY_USERS.DEFAULT下,列出了已经在拨号网络中建立的拨号连接
的名称及其属性设置,其中各项目的名称即为可用的拨号连接的名称;各项目的值即为各连接的属性设置.
如果在InterNet Explorer 中设置了默认连接名称(Internet 选项=>>连接=>>设置=>>使用以下拨号网络连接)
则在注册表的HKEY_USERS.Default下,有一个字符串类型的键值,键值名InternetProfile,其值
即为Internet Explorer中设置的默认连接名称.
{在Uses中增加Registry单元,用于操作注册表}
procedure TForm1.button3click(Sender:TObject);
var
registrytemp:TRegistry;
stringtemp:TStringlist;
intindex:integer;
begin
registrytemp:=TRegistry.Create;
stringTemp:=Tstringlist.Create;
with registryTemp DO
BEGIN
RootKey:=HKEY_USERS; //根键置为HKEY_USERS
//如果存在于子键.Default
if OpenKey('.Default',false) then
getValueNames(stringsTemp); //读出各项目的名称,即拨号连接名称
closekey;
end;
memo1.lines.add( '************当前系统中有'+IntTostr(stringsTemp.count)'
+'各可用的拨号连接如下******');
for intindex:=0 to stringsTemp.count-1 do
memo1.lines.add(stringstemp.strings[intindex]); //列出Internet explorer中默认连接名称.
if registrytemp.Openkey('.Default',false') then
mome1.lines.add('Internet explorer中默认连接名称为'+Registry.readstring('InternetProfile'));
//释放内存
RegistryTemp.free;
StringsTemp.free;
end;
Top
3 楼Alanwn(天痴(日本人与狗不得回答问题))回复于 2003-11-03 11:33:07 得分 0
大哥是win2000,和win9x不一样的
win2000下注册表里没有的
晕~~Top
4 楼Hedonism(江悦)回复于 2003-11-03 13:44:39 得分 0
gz
Top
5 楼Alanwn(天痴(日本人与狗不得回答问题))回复于 2003-11-04 17:30:28 得分 0
没有人解决我如何揭贴呢?快来啊,高手们!
都多少天了,还没有解决啊!
你们的性欲跑哪去了,该用到你们高手的时候没人来啊!!!
Top
6 楼Alanwn(天痴(日本人与狗不得回答问题))回复于 2003-11-05 10:21:15 得分 0
高手们,拿出你们的性欲来强奸我~~~~~~~------------------------这个问题吧!Top
7 楼Goldteerfei(爱情没有谁对不起谁,只有谁不懂得的珍惜!)回复于 2003-11-05 16:55:14 得分 3
够疯狂的。Top
8 楼houlinghouling(秋水伊)回复于 2003-11-06 11:08:12 得分 42
{ These are from lmcons.h }
DNLEN = 15; // Maximum domain name length
UNLEN = 256; // Maximum user name length
PWLEN = 256; // Maximum password length
NETBIOS_NAME_LEN = 16; // NetBIOS net name (bytes)
RAS_MaxDeviceType = 16;
RAS_MaxPhoneNumber = 128;
RAS_MaxIpAddress = 15;
RAS_MaxIpxAddress = 21;
{$IFDEF WINVER31}
{Version 3.x sizes }
RAS_MaxEntryName = 20;
RAS_MaxDeviceName = 32;
RAS_MaxCallbackNumber = 48;
{$ELSE}
{Version 4.x sizes }
RAS_MaxEntryName = 256;
RAS_MaxDeviceName = 128;
RAS_MaxCallbackNumber = RAS_MaxPhoneNumber;
{$ENDIF}
RAS_MaxAreaCode = 10;
RAS_MaxPadType = 32;
RAS_MaxX25Address = 200;
RAS_MaxFacilities = 200;
RAS_MaxUserData = 200;
type
LPHRasConn = ^THRasConn;
THRasConn = Longint;
{* Identifies an active RAS connection. (See RasEnumConnections)
*}
LPRasConnW = ^TRasConnW;
TRasConnW = record
dwSize: Longint;
hrasconn: THRasConn;
szEntryName: array[0..RAS_MaxEntryName] of WideChar;
{$IFNDEF WINVER31}
szDeviceType: array[0..RAS_MaxDeviceType] of WideChar;
szDeviceName: array[0..RAS_MaxDeviceName] of WideChar;
{$ENDIF}
{$IFDEF WINVER41}
szPhonebook: array[0..MAX_PATH - 1] of WideChar;
dwSubEntry: Longint;
{$ENDIF}
end;
LPRasConnA = ^TRasConnA;
TRasConnA = record
dwSize: Longint;
hrasconn: THRasConn;
szEntryName: array[0..RAS_MaxEntryName] of AnsiChar;
{$IFNDEF WINVER31}
szDeviceType: array[0..RAS_MaxDeviceType] of AnsiChar;
szDeviceName: array[0..RAS_MaxDeviceName] of AnsiChar;
{$ENDIF}
{$IFDEF WINVER41}
szPhonebook: array[0..MAX_PATH - 1] of AnsiChar;
dwSubEntry: Longint;
{$ENDIF}
end;
LPRasConn = ^TRasConn;
TRasConn = TRasConnA;
const
{* Enumerates intermediate states to a connection. (See RasDial)
*}
RASCS_PAUSED = $1000;
RASCS_DONE = $2000;
type
LPRasConnState = ^TRasConnState;
TRasConnState = Integer;
const
RASCS_OpenPort = 0;
RASCS_PortOpened = 1;
RASCS_ConnectDevice = 2;
RASCS_DeviceConnected = 3;
RASCS_AllDevicesConnected = 4;
RASCS_Authenticate = 5;
RASCS_AuthNotify = 6;
RASCS_AuthRetry = 7;
RASCS_AuthCallback = 8;
RASCS_AuthChangePassword = 9;
RASCS_AuthProject = 10;
RASCS_AuthLinkSpeed = 11;
RASCS_AuthAck = 12;
RASCS_ReAuthenticate = 13;
RASCS_Authenticated = 14;
RASCS_PrepareForCallback = 15;
RASCS_WaitForModemReset = 16;
RASCS_WaitForCallback = 17;
RASCS_Projected = 18;
{$IFNDEF WINVER31}
RASCS_StartAuthentication = 19;
RASCS_CallbackComplete = 20;
RASCS_LogonNetwork = 21;
{$ENDIF}
RASCS_Interactive = RASCS_PAUSED;
RASCS_RetryAuthentication = RASCS_PAUSED + 1;
RASCS_CallbackSetByCaller = RASCS_PAUSED + 2;
RASCS_PasswordExpired = RASCS_PAUSED + 3;
RASCS_Connected = RASCS_DONE;
RASCS_Disconnected = RASCS_DONE + 1;
type
{* Describes the status of a RAS connection. (See RasConnectionStatus)
*}
LPRasConnStatusW = ^TRasConnStatusW;
TRasConnStatusW = record
dwSize: Longint;
rasconnstate: TRasConnState;
dwError: LongInt;
szDeviceType: array[0..RAS_MaxDeviceType] of WideChar;
szDeviceName: array[0..RAS_MaxDeviceName] of WideChar;
{$IFDEF WINVER41}
swPhoneNumber: array[0..RAS_MaxPhoneNumber] of WideChar;
{$ENDIF}
end;
LPRasConnStatusA = ^TRasConnStatusA;
TRasConnStatusA = record
dwSize: Longint;
rasconnstate: TRasConnState;
dwError: LongInt;
szDeviceType: array[0..RAS_MaxDeviceType] of AnsiChar;
szDeviceName: array[0..RAS_MaxDeviceName] of AnsiChar;
{$IFDEF WINVER41}
swPhoneNumber: array[0..RAS_MaxPhoneNumber] of AnsiChar;
{$ENDIF}
end;
LPRasConnStatus = ^TRasConnStatus;
TRasConnStatus = TRasConnStatusA;
{* Describes connection establishment parameters. (See RasDial)
*}
LPRasDialParamsW = ^TRasDialParamsW;
TRasDialParamsW = record
dwSize: LongInt;
szEntryName: array[0..RAS_MaxEntryName] of WideChar;
szPhoneNumber: array[0..RAS_MaxPhoneNumber] of WideChar;
szCallbackNumber: array[0..RAS_MaxCallbackNumber] of WideChar;
szUserName: array[0..UNLEN] of WideChar;
szPassword: array[0..PWLEN] of WideChar;
szDomain: array[0..DNLEN] of WideChar;
{$IFDEF WINVER41}
dwSubEntry: Longint;
dwCallbackId: Longint;
{$ENDIF}
end;
Top
9 楼houlinghouling(秋水伊)回复于 2003-11-06 11:10:23 得分 0
LPRasDialParamsA = ^TRasDialParamsA;
TRasDialParamsA = record
dwSize: LongInt;
szEntryName: array[0..RAS_MaxEntryName] of AnsiChar;
szPhoneNumber: array[0..RAS_MaxPhoneNumber] of AnsiChar;
szCallbackNumber: array[0..RAS_MaxCallbackNumber] of AnsiChar;
szUserName: array[0..UNLEN] of AnsiChar;
szPassword: array[0..PWLEN] of AnsiChar;
szDomain: array[0..DNLEN] of AnsiChar;
{$IFDEF WINVER41}
dwSubEntry: Longint;
dwCallbackId: Longint;
{$ENDIF}
end;
LPRasDialParams = ^TRasDialParams;
TRasDialParams = TRasDialParamsA;
{* Describes extended connection establishment options. (See RasDial)
*}
LPRasDialExtensions = ^TRasDialExtensions;
TRasDialExtensions = record
dwSize: LongInt;
dwfOptions: LongInt;
hwndParent: HWND;
reserved: LongInt;
end;
const
{* 'dwfOptions' bit flags.
*}
RDEOPT_UsePrefixSuffix = $00000001;
RDEOPT_PausedStates = $00000002;
RDEOPT_IgnoreModemSpeaker = $00000004;
RDEOPT_SetModemSpeaker = $00000008;
RDEOPT_IgnoreSoftwareCompression = $00000010;
RDEOPT_SetSoftwareCompression = $00000020;
RDEOPT_DisableConnectedUI = $00000040;
RDEOPT_DisableReconnectUI = $00000080;
RDEOPT_DisableReconnect = $00000100;
RDEOPT_NoUser = $00000200;
RDEOPT_PauseOnScript = $00000400;
type
{* Describes an enumerated RAS phone book entry name. (See RasEntryEnum)
*}
LPRasEntryNameW = ^TRasEntryNameW;
TRasEntryNameW = record
dwSize: Longint;
szEntryName: array[0..RAS_MaxEntryName] of WideChar;
end;
LPRasEntryNameA = ^TRasEntryNameA;
TRasEntryNameA = record
dwSize: Longint;
szEntryName: array[0..RAS_MaxEntryName] of AnsiChar;
end;
LPRasEntryName = ^TRasEntryName;
TRasEntryName = TRasEntryNameA;
{* Protocol code to projection data structure mapping.
*}
LPRasProjection = ^TRasProjection;
TRasProjection = Integer;
const
RASP_Amb = $10000;
RASP_PppNbf = $803F;
RASP_PppIpx = $802B;
RASP_PppIp = $8021;
RASP_PppLcp = $C021;
RASP_Slip = $20000;
type
{* Describes the result of a RAS AMB (Authentication Message Block)
** projection. This protocol is used with NT 3.1 and OS/2 1.3 downlevel
** RAS servers.
*}
LPRasAmbW = ^TRasAmbW;
TRasAmbW = record
dwSize: Longint;
dwError: Longint;
szNetBiosError: array[0..NETBIOS_NAME_LEN] of WideChar;
bLana: Byte;
end;
LPRasAmbA = ^TRasAmbA;
TRasAmbA = record
dwSize: Longint;
dwError: Longint;
szNetBiosError: array[0..NETBIOS_NAME_LEN] of AnsiChar;
bLana: Byte;
end;
LPRasAmb = ^TRasAmb;
TRasAmb = TRasAmbA;
{* Describes the result of a PPP NBF (NetBEUI) projection.
*}
LPRasPppNbfW = ^TRasPppNbfW;
TRasPppNbfW = record
dwSize: Longint;
dwError: Longint;
dwNetBiosError: Longint;
szNetBiosError: array[0..NETBIOS_NAME_LEN] of WideChar;
szWorkstationName: array[0..NETBIOS_NAME_LEN] of WideChar;
bLana: Byte;
end;
LPRasPppNbfA = ^TRasPppNbfA;
TRasPppNbfA = record
dwSize: Longint;
dwError: Longint;
dwNetBiosError: Longint;
szNetBiosError: array[0..NETBIOS_NAME_LEN] of AnsiChar;
szWorkstationName: array[0..NETBIOS_NAME_LEN] of AnsiChar;
bLana: Byte;
end;
LpRaspppNbf = ^TRasPppNbf;
TRasPppNbf = TRasPppNbfA;
{* Describes the results of a PPP IPX (Internetwork Packet Exchange)
** projection.
*}
LPRasPppIpxW = ^TRasPppIpxW;
TRasPppIpxW = record
dwSize: Longint;
dwError: Longint;
szIpxAddress: array[0..RAS_MaxIpxAddress] of WideChar;
end;
LPRasPppIpxA = ^TRasPppIpxA;
TRasPppIpxA = record
dwSize: Longint;
dwError: Longint;
szIpxAddress: array[0..RAS_MaxIpxAddress] of AnsiChar;
end;
LPRasPppIpx = ^TRasPppIpx;
TRasPppIpx = TRasPppIpxA;
{* Describes the results of a PPP IP (Internet) projection.
*}
LPRasPppIpW = ^TRasPppIpW;
TRasPppIpW = record
dwSize: Longint;
dwError: Longint;
szIpAddress: array[0..RAS_MaxIpAddress] of WideChar;Top
10 楼houlinghouling(秋水伊)回复于 2003-11-06 11:11:00 得分 0
LPRasPppIpA = ^TRasPppIpA;
TRasPppIpA = record
dwSize: Longint;
dwError: Longint;
szIpAddress: array[0..RAS_MaxIpAddress] of AnsiChar;
{$IFNDEF WINNT35COMPATIBLE}
{* See RASPPPIPW comment.
*}
szServerIpAddress: array[0..RAS_MaxIpAddress] of AnsiChar;
{$ENDIF}
end;
LPRasPppIp = ^TRasPppIp;
TRasPppIp = TRasPppIpA;
{* Describes the results of a PPP LCP/multi-link negotiation.
*}
LpRasPppLcp = ^TRasPppLcp;
TRasPppLcp = record
dwSize: Longint;
fBundled: LongBool;
end;
{* Describes the results of a SLIP (Serial Line IP) projection.
*}
LpRasSlipW = ^TRasSlipW;
TRasSlipW = record
dwSize: Longint;
dwError: Longint;
szIpAddress: array[0..RAS_MaxIpAddress] of WideChar;
end;
LpRasSlipA = ^TRasSlipA;
TRasSlipA = record
dwSize: Longint;
dwError: Longint;
szIpAddress: array[0..RAS_MaxIpAddress] of AnsiChar;
end;
LpRasSlip = ^TRasSlip;
TRasSlip = TRasSlipA;
const
{* If using RasDial message notifications, get the notification message code
** by passing this string to the RegisterWindowMessageA() API.
** WM_RASDIALEVENT is used only if a unique message cannot be registered.
*}
RASDIALEVENT = 'RasDialEvent';
WM_RASDIALEVENT = $CCCD;
{* Prototypes for caller's RasDial callback handler. Arguments are the
** message ID (currently always WM_RASDIALEVENT), the current RASCONNSTATE and
** the error that has occurred (or 0 if none). Extended arguments are the
** handle of the RAS connection and an extended error code.
**
** For RASDIALFUNC2, subsequent callback notifications for all
** subentries can be cancelled by returning FALSE.
*}
{
typedef VOID (WINAPI *RASDIALFUNC)( UINT, RASCONNSTATE, DWORD );
typedef VOID (WINAPI *RASDIALFUNC1)( HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD );
typedef DWORD (WINAPI *RASDIALFUNC2)( DWORD, DWORD, HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD );
For Delphi: Just define the callback as:
procedure RASCallback(msg: Integer; state: TRasConnState;
dwError: Longint); stdcall;
procedure RASCallback1(hConn: THRasConn; msg: Integer;
state: TRasConnState; dwError: Longint; dwEexterror: Longint); stdcall;
procedure RASCallback2(dwCallbackId, dwSubEntry: Longint; hConn: THRasConn;
msg: Integer; state: TRasConnState; dwError: Longint;
dwEexterror: Longint); stdcall;
}
type
{* Information describing a RAS-capable device.
*}
LPRasDevInfoA = ^TRasDevInfoA;
TRasDevInfoA = record
dwSize: Longint;
szDeviceType: array[0..RAS_MaxDeviceType] of AnsiChar;
szDeviceName: array[0..RAS_MaxDeviceName] of AnsiChar;
end;
LPRasDevInfoW = ^TRasDevInfoW;
TRasDevInfoW = record
dwSize: Longint;
szDeviceType: array[0..RAS_MaxDeviceType] of WideChar;
szDeviceName: array[0..RAS_MaxDeviceName] of WideChar;
end;
LPRasDevInfo = ^TRasDevInfo;
TRasDevInfo = TRasDevInfoA;
(* RAS Country Information (currently retreieved from TAPI).
*)
LPRasCtryInfo = ^TRasCtryInfo;
TRasCtryInfo = record
dwSize,
dwCountryID,
dwNextCountryID,
dwCountryCode,
dwCountryNameOffset: Longint;
end;Top




