• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

取当前所有的拨号连接的程式_Delphi

Delphi 搞代码 3年前 (2018-08-09) 117次浏览 已收录 0个评论

{+++++++++++++++++++++++
  取当前所有的拨号连接的程式;
  参数为传入的列表,过程成功为参数付值且返回值为真
  否则为假;
  调用方法类似
  if GetEntries(Memo1.Lines) then
  begin
  end
  else
  begin

http://www.gaodaima.com/65667.html取当前所有的拨号连接的程式_Delphi

  end;
Date:2001/03/07  12:30—–13:32
Remark:
+++++++++++++++++++++++++++++++++++++++++++++++++++++
}
function TForm1.GetEntries(List: TStrings):Boolean;
type
  TRasEntryName = record
    Size : DWORD;
    EntryName:  array[0..256] of Char;
  end;

  TRasEnumEntries =  function(Reserved : Pointer;
                              PhoneBook : Pointer;
                              RasEntryName : Pointer;
                              var cb : DWORD;
                              var Entries : DWORD) : DWORD; stdcall;

const
  RasAPI32=’RASAPI32.dll’;

var
  FRasLibHandle : THandle;
  RasEntries : array[1..25] of TRasEntryName;
  Size : DWORD;
  Count : DWORD;
  i : DWORD;
  RasEnumEntries : TRasEnumEntries;
begin
//  if List=Nil then Exit;
try
    List.Clear;

    FRasLibHandle:=LoadLibrary(RasAPI32);
    try
      if FRasLibHandle=0 then Exit;

    { 获取RasEnumEntriesA方法地址;本方法的关键是对RASAPI32.dll提供的方法要
      熟悉,利用API过程GetProcAddress来取DLL中的方法地址,给方法指针付值后
      调用,其它如拨号程式,
      TRasDial =  function(RasDialExtensions : Pointer;
                            PhoneBook : Pointer;
                            var RasDialParams : TRasDialParams;
                            NotifierType : DWORD;
                            Notifier : Pointer;
                            var RasConn : THandle) : DWORD; stdcall;

      @RasDial:=GetProcAddress(FRasLibHandle,’RasDialA’);
      拨号后挂起程式
      TRasHangUp =  function(RassCon : THandle) : DWORD; stdcall;
      @RasHangUp:=GetProcAddress(FRasLibHandle,’RasHangUpA’);
    类同}
      @RasEnumEntries:=GetProcAddress(FRasLibHandle,’RasEnumEntriesA’);
      if @RasEnumEntries=nil then Exit;

      RasEntries[1].Size:=SizeOf(TRasEntryName);
      Size:=SizeOf(RasEntries);
      if RasEnumEntries(nil,nil,@RasEntries,Size,Count)=0 then
      begin
        for i:=1 to Count do
          List.Add(RasEntries[i].EntryName);
      end;
      Result:=True;
    finally
      FreeLibrary(FRasLibHandle);
    end;
except
end;

end; 

欢迎大家阅读《取当前所有的拨号连接的程式_Delphi,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址