Delete history files without showing a dialog

I am trying to delete history files from web browser in C# as in the following post:

How to clear browsing history using WebBrowser control in C#

But I don't want to show any message dialogs while I am clearing the history.

How can I accomplish that?

Upvotes: 0

Views: 2638

Answers (1)

volody
volody

Reputation: 7189

Looks like your question is related to how I can run next line without showing command window

System.Diagnostics.Process.Start("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 8");

You can do that using next code

try
{
    var psi = new System.Diagnostics.ProcessStartInfo("rundll32.exe", "InetCpl.cpl,ClearMyTracksByProcess 8");
    psi.CreateNoWindow = true;
    psi.UseShellExecute = false;
    psi.RedirectStandardOutput = true;
    psi.RedirectStandardInput = true;
    psi.RedirectStandardError = true;
    System.Diagnostics.Process.Start(psi);
}
catch (Exception ex)
{
    System.Diagnostics.Debug.WriteLine(ex.ToString());
}

Upvotes: 1

Related Questions