[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

flushdns

Posted on 2011-09-26
2
Medium Priority
?
1,358 Views
Last Modified: 2016-10-03
I need to clear the DNS cache and I don't want to use "ipconfig /flushdns".
It looks like dnsapi.dll can be used for that but I can't find any Delphi code example.
Below is a C language example.
I'd like to have the same function for Delphi 7.
Thanks.

BOOL DnsFlushResolverCache()
{
   BOOL (WINAPI *DoDnsFlushResolverCache)();
   *(FARPROC *)&DoDnsFlushResolverCache = GetProcAddress(LoadLibrary("dnsapi.dll"), "DnsFlushResolverCache");
   if(!DoDnsFlushResolverCache) return FALSE;
   return DoDnsFlushResolverCache();
}

Open in new window

0
Comment
Question by:3axap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Assisted Solution

by:DerZauberer
DerZauberer earned 800 total points
ID: 36598107
The above should be the declaration.

unit

...

interface

...

implementation

{ declaration }
Function DnsFlushResolverCache: DWord; stdcall; external 'dnsapi.dll';

...

{ call it }
procedure CallIt;
begin
  { call it, ignore return code }
  DnsFlushResolverCache;
end;
0
 
LVL 4

Accepted Solution

by:
rotem156 earned 1200 total points
ID: 36598286
You're welcome.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question