Daniel Vasquez Lopez

Tuesday, May 11, 2004

P/Invoke Add-in for Visual Studio.NET

This is a very, very useful tool that can help you to find quickly the P/Invoke definition for almost any Win32 API function into the Visual Studio .NET. If the P/Invoke definition does not exist, but you did make it work, you can share your definition with other developers in the globe!.
This tool was developed by
Adam Nathan, a P/Invoke expert here at Microsoft that wrote a great book Interoperability in .NET.
This tool communicates with a
P/Invoke WiKi Web Site through a Web Service.
Try it out, it might save you several minutes debugging...

Sunday, May 09, 2004

How to clear the Downloaded Cache programatically?

The most important thing that you must considerate before clear the Downloade Cache programmatically it's that the .NET Framework has a default 50MB quota for this cache, so that you don't have to worry about the growing without a size controlled. Additionally, this API won't work for further versions of the .NET Framework. Please check the Alan Shi's blog for more information.
The following C# code clears the Downloaded Cache:

using System.Runtime.InteropServices;
sealed class App
{
[DllImport("fusion.dll")]
static extern void NukeDownloadedCache();
static void Main()
{
NukeDownloadedCache();
}
}