我正在尝试在我的c#应用程序中打开U盘中的文件。如果文件损坏,我会在C#中处理IOException。不幸的是,Windows10也显示了一个我想要禁止显示的消息框。
try
{
// Open file and read all lines to trigger the exception if file is bad
string[] lines = File.ReadAllLines(s);
}
catch (IOException e)
{
// Corrupted File found Execute CHKDSK on that drive
}C#正在按预期处理该异常。但Windows显示以下消息:

有没有办法抑制Windows警告窗口?谢谢你的帮助。
发布于 2019-09-10 20:19:03
一种解决方案是通过标题查找Windows消息窗口,并以这种方式关闭它:How to close the window by its name?
它是有效的,但它是一个黑客。任何其他解决方案都非常受欢迎。
https://stackoverflow.com/questions/57865797
复制相似问题