谢谢楼上的 首先我们需要配置服务器端的RAS服务,在这里以2k Server 为例,第一安装modem,选择"控制面板"中的"网络和拨号连接",新建连接, 选择"接受接入的连接",并且在最后一步添加一个允许登录 的帐号,本文设置用户名:xr 密码:xr,这样就在服务器端 建立了一个"等待接入"的连接但我想知道有没有API能够执行上面的操作,而不是自己在“网络和拨号连接”中新建连接,因为老板说你要把用户当成是SB,我们的产品越智能越好^_^
1。创建新的拨号连接。 参数: hwn PROCEDURE TForm1.button1click(Sender:TObject); VAR dwhandle:word; aaa:integer; begin aaa:=getactivewindow(); dwResult:=RasCreatePhonebookEntryA(handle,''); 或DWresult:=RasCreatePhonebookEntryA(aaa,''); if dwResult=0 then memo1.lines.add('新建拨号连接成功!') ELSE memo1.lines.add('新建拨号连接失败!')
end; 2.修改指定拨号连接的属性。 Function RasEditPhonebookEntryA(hwnd:Thandle;lpszPhonebook:pchar;lpszEntryName:pchar):Dword; stdcall; {位于Interface的USES 下 TYPEend 之外} lpszEntryName(pchar):要修改的拨号连接的名称,如‘163’,‘169’等。 函数返回值:0表示成功,否则为错误。 例:PROcedure TForm1.button2click(Sender:TObject); 如上。 3.获取当前系统中可用的拨号连接名称.。 在建立了拨号连接后,WIN9X将拨号连接的名称和属性写了注册表中,我们可以从注册表中可用的拨号连接名称 及InterNet Explorer中的默认连接名称。 在注册表的HKEY_USERS\.DEFAULT\RemoteACess\Address下,列出了已经在拨号网络中建立的拨号连接 的名称及其属性设置,其中各项目的名称即为可用的拨号连接的名称;各项目的值即为各连接的属性设置. 如果在InterNet Explorer 中设置了默认连接名称(Internet 选项=>>连接=>>设置=>>使用以下拨号网络连接) 则在注册表的HKEY_USERS\.Default\RemoteAcess下,有一个字符串类型的键值,键值名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\RemoteAccess\Addresses if OpenKey('.Default\RemoteAccess\Addresses',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\RemoteAccess\Addresses',false') then mome1.lines.add('Internet explorer中默认连接名称为'+Registry.readstring('InternetProfile')); //释放内存 RegistryTemp.free; StringsTemp.free; end; 4.用指定的拨号连接拨号 winexec('rundll32.exe rnaui.dll,RnaDial 163',SW_SHOWNORMAL); 其中字符串中的最后一个参数'163'为拨号连接的名称. Procedure TForm1.botton4click(Sender:TObject); var strDiaName:string; begin strDiaName:='163'; memo1.lines.add('*****用拨号连接'+strDiaName+'实现拨号上网******'); winexec('rundll32.exe rnaui.dll,RnaDial 163',SW_SHOWNORMAL); end; end;--------------------------------- delphi的,凑活着看看吧,也是copy的,有个路了,查查msdn就好了
这方面的知识应该是你所要的
为例,第一安装modem,选择"控制面板"中的"网络和拨号连接",新建连接,
选择"接受接入的连接",并且在最后一步添加一个允许登录
的帐号,本文设置用户名:xr 密码:xr,这样就在服务器端
建立了一个"等待接入"的连接但我想知道有没有API能够执行上面的操作,而不是自己在“网络和拨号连接”中新建连接,因为老板说你要把用户当成是SB,我们的产品越智能越好^_^
参数:
hwn PROCEDURE TForm1.button1click(Sender:TObject);
VAR dwhandle:word;
aaa:integer;
begin
aaa:=getactivewindow();
dwResult:=RasCreatePhonebookEntryA(handle,'');
或DWresult:=RasCreatePhonebookEntryA(aaa,'');
if dwResult=0 then
memo1.lines.add('新建拨号连接成功!')
ELSE
memo1.lines.add('新建拨号连接失败!')
end;
2.修改指定拨号连接的属性。
Function RasEditPhonebookEntryA(hwnd:Thandle;lpszPhonebook:pchar;lpszEntryName:pchar):Dword;
stdcall; {位于Interface的USES 下 TYPEend 之外}
lpszEntryName(pchar):要修改的拨号连接的名称,如‘163’,‘169’等。
函数返回值:0表示成功,否则为错误。
例:PROcedure TForm1.button2click(Sender:TObject);
如上。
3.获取当前系统中可用的拨号连接名称.。
在建立了拨号连接后,WIN9X将拨号连接的名称和属性写了注册表中,我们可以从注册表中可用的拨号连接名称
及InterNet Explorer中的默认连接名称。
在注册表的HKEY_USERS\.DEFAULT\RemoteACess\Address下,列出了已经在拨号网络中建立的拨号连接
的名称及其属性设置,其中各项目的名称即为可用的拨号连接的名称;各项目的值即为各连接的属性设置.
如果在InterNet Explorer 中设置了默认连接名称(Internet 选项=>>连接=>>设置=>>使用以下拨号网络连接)
则在注册表的HKEY_USERS\.Default\RemoteAcess下,有一个字符串类型的键值,键值名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\RemoteAccess\Addresses
if OpenKey('.Default\RemoteAccess\Addresses',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\RemoteAccess\Addresses',false') then
mome1.lines.add('Internet explorer中默认连接名称为'+Registry.readstring('InternetProfile'));
//释放内存
RegistryTemp.free;
StringsTemp.free;
end;
4.用指定的拨号连接拨号
winexec('rundll32.exe rnaui.dll,RnaDial 163',SW_SHOWNORMAL);
其中字符串中的最后一个参数'163'为拨号连接的名称.
Procedure TForm1.botton4click(Sender:TObject);
var
strDiaName:string;
begin
strDiaName:='163';
memo1.lines.add('*****用拨号连接'+strDiaName+'实现拨号上网******');
winexec('rundll32.exe rnaui.dll,RnaDial 163',SW_SHOWNORMAL);
end;
end;---------------------------------
delphi的,凑活着看看吧,也是copy的,有个路了,查查msdn就好了