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

  • 内容
  • 评论
  • 相关

{+++++++++++++++++++++++
  取当前所有的拨号连接的程式;
  参数为传入的列表,过程成功为参数付值且返回值为真
  否则为假;
  调用方法类似
  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 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: 取当前所有的拨号连接的程式_Delphi

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注