gpt4 book ai didi

c# - TaskDialog 无法在 Windows 10 上运行(或替代)?

转载 作者:太空宇宙 更新时间:2023-11-03 12:21:50 24 4
gpt4 key购买 nike

我们有一个较旧的 WPF 应用程序,它使用“Windows API 代码包”来显示任务对话框(在 Vista 中引入的东西,但在 Windows 8 中一直有效)。

我现在尝试在 Windows 10 上运行该项目,当我尝试显示任务对话框时,出现以下异常:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods.TaskDialogIndirect (TaskDialogConfiguration taskConfig, Int32& button, Int32& radioButton, Boolean& verificationFlagChecked)
at Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.NativeShow()
at Microsoft.WindowsAPICodePack.Dialogs.TaskDialog.ShowCore()

这些 API 在 Windows 10 中不再可用吗?

是否有无需编写自定义对话框即可在 Windows 10 中使用具有类似功能的替代品?

编辑:我让它运行了(我猜是纯粹的运气?我没有更改任何代码)并且对话框弹出如下:

Win10 Task Dialog

应该有 3 个按钮,绝对没有中文字符,所以我同意这里肯定存在内存问题的异常(exception)情况。有什么想法吗?

最佳答案

Windows 10 仍然支持任务对话框,但问题可能出在您似乎正在使用的库中:https://github.com/aybe/Windows-API-Code-Pack-1.1/issues/3

如问题描述中所述,它可能会在 64 位 Windows 上导致 AccessViolationException(可能还有不正确的字符)。您可以通过应用引用的拉取请求中的更改来修复它。

注意:由于 WinForms 是开源的,因此有人请求在未来的 .NET Core 版本中包含官方任务对话框实现:https://github.com/dotnet/winforms/issues/146

关于c# - TaskDialog 无法在 Windows 10 上运行(或替代)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46838210/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com