delphi 能调API调设网卡MAC、IP、网关吗
解决方案 »
- 关于查询日期段的问题
- 出错!!!
- DataPreviewForm裡放置了一個QuickRep,怎樣在關閉QuickRep的Preview時同時關閉DataPreviewForm?
- Delphi里有几种弹出对话框,带的参数是怎么样的???
- 字符串怎么转换为TFileName类型
- 请推荐与 DELPHI 相关的 XML 编程书籍
- 关于多线程同时使用TCustomWinSocket.SendBuf的问题
- 请问哪儿有票据打印的控件
- 如何让显示的窗口在桌面的最上面,而不被其他窗口遮住那?
- 简单问题!控件所有者属性怎么设?
- delphi WM_GETTEXT 取得其他软件上的中文?
- 取网络时间为什么不行?
iphlpapilib = iphlpapi.dll;
{$ifndef iphlpapi_dynlink}
function getnumberofinterfaces; external iphlpapilib name getnumberofinterfaces;
function getifentry; external iphlpapilib name getifentry;
function getiftable; external iphlpapilib name getiftable;
function getipaddrtable; external iphlpapilib name getipaddrtable;
function getipnettable; external iphlpapilib name getipnettable;
function getipforwardtable; external iphlpapilib name getipforwardtable;
function gettcptable; external iphlpapilib name gettcptable;
function getudptable; external iphlpapilib name getudptable;
function getipstatistics; external iphlpapilib name getipstatistics;
function geticmpstatistics; external iphlpapilib name geticmpstatistics;
function gettcpstatistics; external iphlpapilib name gettcpstatistics;
function getudpstatistics; external iphlpapilib name getudpstatistics;
function setifentry; external iphlpapilib name setifentry;
function createipforwardentry; external iphlpapilib name createipforwardentry;
function setipforwardentry; external iphlpapilib name setipforwardentry;
function deleteipforwardentry; external iphlpapilib name deleteipforwardentry;
function setipstatistics; external iphlpapilib name setipstatistics;
function setipttl; external iphlpapilib name setipttl;
function createipnetentry; external iphlpapilib name createipnetentry;
function setipnetentry; external iphlpapilib name setipnetentry;
function deleteipnetentry; external iphlpapilib name deleteipnetentry;
function flushipnettable; external iphlpapilib name flushipnettable;
function createproxyarpentry; external iphlpapilib name createproxyarpentry;
function deleteproxyarpentry; external iphlpapilib name deleteproxyarpentry;
function settcpentry; external iphlpapilib name settcpentry;
function getinterfaceinfo; external iphlpapilib name getinterfaceinfo;
function getunidirectionaladapterinfo; external iphlpapilib name getunidirectionaladapterinfo;
function getbestinterface; external iphlpapilib name getbestinterface;
function getbestroute; external iphlpapilib name getbestroute;
function notifyaddrchange; external iphlpapilib name notifyaddrchange;
function notifyroutechange; external iphlpapilib name notifyroutechange;
function getadapterindex; external iphlpapilib name getadapterindex;
function addipaddress; external iphlpapilib name addipaddress;
function deleteipaddress; external iphlpapilib name deleteipaddress;
function getnetworkparams; external iphlpapilib name getnetworkparams;
function getadaptersinfo; external iphlpapilib name getadaptersinfo;
function getperadapterinfo; external iphlpapilib name getperadapterinfo;
function ipreleaseaddress; external iphlpapilib name ipreleaseaddress;
function iprenewaddress; external iphlpapilib name iprenewaddress;
function sendarp; external iphlpapilib name sendarp;
function getrttandhopcount; external iphlpapilib name getrttandhopcount;
function getfriendlyifindex; external iphlpapilib name getfriendlyifindex;
function enablerouter; external iphlpapilib name enablerouter;
function unenablerouter; external iphlpapilib name unenablerouter;
{$else}
var
hiphlpapi: thandle = 0;
function iphlpapiinitapi: boolean;
begin
result := false;
if hiphlpapi = 0 then hiphlpapi := loadlibrary(iphlpapilib);
if hiphlpapi > hinstance_error then
begin
@getnetworkparams := getprocaddress(hiphlpapi, getnetworkparams);
@getadaptersinfo := getprocaddress(hiphlpapi, getadaptersinfo);
@getperadapterinfo := getprocaddress(hiphlpapi, getperadapterinfo);
@getadapterindex := getprocaddress(hiphlpapi, getadapterindex);
@getunidirectionaladapterinfo := getprocaddress(hiphlpapi, getunidirectionaladapterinfo);
@getnumberofinterfaces := getprocaddress(hiphlpapi, getnumberofinterfaces);
@getinterfaceinfo := getprocaddress(hiphlpapi, getinterfaceinfo);
@getfriendlyifindex := getprocaddress(hiphlpapi, getfriendlyifindex);
@getiftable := getprocaddress(hiphlpapi, getiftable);
@getifentry := getprocaddress(hiphlpapi, getifentry);
@setifentry := getprocaddress(hiphlpapi, setifentry);
@getipaddrtable := getprocaddress(hiphlpapi, getipaddrtable);
@addipaddress := getprocaddress(hiphlpapi, addipaddress);
@deleteipaddress := getprocaddress(hiphlpapi, deleteipaddress);
@ipreleaseaddress := getprocaddress(hiphlpapi, ipreleaseaddress);
@iprenewaddress := getprocaddress(hiphlpapi, iprenewaddress);
@getipnettable := getprocaddress(hiphlpapi, getipnettable);
@createipnetentry := getprocaddress(hiphlpapi, createipnetentry);
@deleteipnetentry := getprocaddress(hiphlpapi, deleteipnetentry);
@createproxyarpentry := getprocaddress(hiphlpapi, createproxyarpentry);
@deleteproxyarpentry := getprocaddress(hiphlpapi, deleteproxyarpentry);
@sendarp := getprocaddress(hiphlpapi, sendarp);
@getipstatistics := getprocaddress(hiphlpapi, getipstatistics);
@geticmpstatistics := getprocaddress(hiphlpapi, geticmpstatistics);
@setipstatistics := getprocaddress(hiphlpapi, setipstatistics);
@setipttl := getprocaddress(hiphlpapi, setipttl);
@getipforwardtable := getprocaddress(hiphlpapi,getipforwardtable);
@createipforwardentry := getprocaddress(hiphlpapi, createipforwardentry);
@gettcptable := getprocaddress(hiphlpapi, gettcptable);
@getudptable := getprocaddress(hiphlpapi, getudptable);
@gettcpstatistics := getprocaddress(hiphlpapi, gettcpstatistics);
@getudpstatistics := getprocaddress(hiphlpapi, getudpstatistics);
@setipforwardentry := getprocaddress(hiphlpapi, setipforwardentry);
@deleteipforwardentry := getprocaddress(hiphlpapi, deleteipforwardentry);
@setipnetentry := getprocaddress(hiphlpapi, setipnetentry);
@settcpentry := getprocaddress(hiphlpapi, settcpentry);
@getbestroute := getprocaddress(hiphlpapi, getbestroute);
@notifyaddrchange := getprocaddress(hiphlpapi, notifyaddrchange);
@notifyroutechange := getprocaddress(hiphlpapi, notifyroutechange);
@getbestinterface := getprocaddress(hiphlpapi, getbestinterface);
@getrttandhopcount := getprocaddress(hiphlpapi, getrttandhopcount);
@enablerouter := getprocaddress(hiphlpapi, enablerouter);
@unenablerouter := getprocaddress(hiphlpapi, unenablerouter);
result := true;
end;
end;
procedure iphlpapifreeapi;
begin
if hiphlpapi <> 0 then freelibrary(hiphlpapi);
hiphlpapi := 0;
end;