【发布时间】:2011-11-24 22:09:29
【问题描述】:
我在 Windows 应用程序中使用 webbrowser 控件。我正在查看 webbrowser 控件中的 url 内容。这里的 url 内容值存储在用户机器的临时 Internet 文件中。
当我单击表单中的关闭按钮时,我正在以编程方式删除临时 Internet 文件。它工作正常。 但在删除过程中出现“消息框,说正在删除临时 Internet 文件”。
这里我不想在删除过程中显示该对话框。 下面是删除用户机器的临时文件的代码。
如何处理..
void DeleteBrowserTempFile()
{
string args = "";
args = ("InetCpl.cpl,ClearMyTracksByProcess 8");
System.Diagnostics.Process process = null;
System.Diagnostics.ProcessStartInfo processStartInfo;
processStartInfo = new System.Diagnostics.ProcessStartInfo();
processStartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\Rundll32.exe";
if ((System.Environment.OSVersion.Version.Major >= 6))
{
// Windows Vista or higher
processStartInfo.Verb = "runas";
}
processStartInfo.Arguments = args;
processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
processStartInfo.UseShellExecute = true;
try
{
process = System.Diagnostics.Process.Start(processStartInfo);
}
catch (Exception ex)
{
Utilities.WriteErrorLog(ex);
}
finally
{
if (!(process == null))
{
process.Dispose();
}
}
}
有没有其他方法可以实现这一点.. 需要你的建议和例子
问候
Anbuselvan
【问题讨论】:
-
IE中有设置退出时删除临时文件。不确定您是否可以从这里访问它...
标签: c# internet-explorer webbrowser-control