DnsFlushResolverCache 清除windows DNS缓存
DnsFlushResolverCache 清除windows DNS缓存
效果等同于ipconfig /flushdns 命令。
DnsFlushResolverCache 函数是在Dnsapi.dll导出,该函数没有任何参数。MSDN中找不到他,看来是个Undocumented函数,函数原型:
BOOL WINAPI DnsFlushResolverCache(VOID);
1
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
BOOL __stdcall DnsFlushResolverCache() { BOOL bRet = FALSE; typedef BOOL (WINAPI *PfuncDnsFlushResolverCache)( VOID ); HMODULE hDnsModule = LoadLibrary( _T( "dnsapi.dll" ) ); if ( hDnsModule != NULL ) { PfuncDnsFlushResolverCache pFlushFun = GetProcAddress( hDnsModule, "DnsFlushResolverCache" ); if ( pFlushFun != NULL ) { pFlushFun(); bRet = TRUE; } FreeLibrary( hDnsModule ); } return bRet; } |
vb6 申明:
1
|
Private Declare Function DnsFlushResolverCache Lib "dnsapi.dll" () As Long |