我用delphi编写的程序中调用iphlpapi.dll中的GetAdaptersInfo()读adpterInfo,但是在me下该函数出现问题,得到的adpterInfo信息不全,仅有网卡IP和MAC,而dhcp的enabled,IP,MAC值不能正常得到(为空)。我试了几次都是同样的结果,我想可能是GetAdaptersInfo在me 下的bug。
  不知还有其它办法能知道me下如何判断某块网卡的DHCP是否enabled吗?

解决方案 »

  1.   

    dos下面有这样的命令
    ipconfig/all
    winexec(pchar('command.com /c ipconfig/all>temp.txt'),sw_hide);
    c:\temp.txt里面有DHCP信息uses shellapi;
    var
      temp:string;
    begin
        temp:='c:\temp.txt';
        if fileexists(temp) then
              deletefile(temp);
        winexec(pchar('command.com /c ipconfig/all>temp.txt'),sw_hide);
        while not fileexists(temp) then
              sleep(3000);
         memo1.clear; 
         memo1.lines.loadfromfile(temp);
        
        
    end;