Like what:
Temporary Internet Files (Temporary Internet file)
RunDll32.exe Inetcpl.cpl,clearmytracksbyprocess 8
Cookies
RunDll32.exe inetcpl.cpl,clearmytracksbyprocess 2
History (historical records)
RunDll32.exe inetcpl.cpl,clearmytracksbyprocess 1
Form. Data (Form information)
RunDll32.exe inetcpl.cpl,clearmytracksbyprocess 16
Passwords (password)
RunDll32.exe Inetcpl.cpl,clearmytracksbyprocess 32
Delete all (remove all)
RunDll32.exe inetcpl.cpl,clearmytracksbyprocess 255
Delete all-"Also deletes files and settings stored by add-ons"
RunDll32.exe inetcpl.cpl,clearmytracksbyprocess 4351
How do we invoke these instructions in C # programming? There are 2 ways to invoke process initiation RunDll32.exe, and the second is to invoke the Win32 API function ShellExecute or CreateProcess to execute the above command line.
Method One: Invoke process start RunDll32.exe
private void Ieclear ()
{
Clear IE cache, cookies, and all records
Process process = new process ();
Process. Startinfo.filename = "RunDll32.exe";
Process. startinfo.arguments = "Inetcpl.cpl,clearmytracksbyprocess 255";
Process. Startinfo.useshellexecute = false;
Process. Startinfo.redirectstandardinput = true;
Process. Startinfo.redirectstandardoutput = true;
Process. Startinfo.redirectstandarderror = true;
Process. Startinfo.createnowindow = true;
Process. Start ();
}
Method Two: Call Win32 API function ShellExecute or CreateProcess to execute the above command line is OK.
public enum Showcommands:int
{
Sw_hide = 0,
Sw_shownormal = 1,
Sw_normal = 1,
sw_showminimized = 2,
sw_showmaximized = 3,
Sw_maximize = 3,
Sw_shownoactivate = 4,
Sw_show = 5,
Sw_minimize = 6,
Sw_showminnoactive = 7,
Sw_showna = 8,
Sw_restore = 9,
Sw_showdefault = 10,
Sw_forceminimize = 11,
Sw_max = 11
}
[DllImport ("Shell32.dll")]
static extern IntPtr ShellExecute (IntPtr hwnd, String lpoperation, String lpfile, String lpparameters, String lpdirectory , Showcommands nShowCmd);
Clear IE Temp file
ShellExecute (IntPtr.Zero, "open", "rundll32.exe", "Inetcpl.cpl,clearmytracksbyprocess 8", "", showcommands.sw_hide);
Through the above methods can be successfully deleted in the software IE cookies, caching, temporary files and so on.