TaskDialog 不适用于(或替代)Windows 10? [英] TaskDialog not working on (or replacement for) Windows 10?

查看:35
本文介绍了TaskDialog 不适用于(或替代)Windows 10?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

We have an older WPF application that makes use of the "Windows API Code Pack" in order to show a Task Dialog (something that was introduced back in Vista but worked all the way through Windows 8).

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

I'm now trying to run the project on Windows 10, and when I try to show the Task Dialog, I get the following exception:

System.AccessViolationException:尝试读取或写入受保护的内存.这通常表明其他内存已损坏.
在 Microsoft.WindowsAPICodePack.Dialogs.TaskDialogNativeMethods.TaskDialogIndirect (TaskDialogConfiguration taskConfig, Int32& button, Int32& radioButton, Boolean& verificationFlagChecked)
在 Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.NativeShow()
在 Microsoft.WindowsAPICodePack.Dialogs.TaskDialog.ShowCore()

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 中不再可用?

Are these APIs no longer available in Windows 10?

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

Is there a replacement with similar functionality that is available in Windows 10 without writing a custom dialog?

我让它运行了(我猜是运气吧?我没有更改任何代码)然后弹出的对话框是这样的:

I got it to run (sheer luck I guess? I didn't change any code) and the dialog popped up like this:

应该有 3 个按钮,而且绝对没有中文字符,所以我同意这里肯定存在一些内存问题的例外.有什么想法吗?

There should be 3 buttons, and definitely no Chinese characters, so I would agree with the exception that there is definitely some memory issue going on here. Any ideas?

推荐答案

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

The Task Dialog is still supported in Windows 10, but the problem is likely this issue in the library that you seem to be using: https://github.com/aybe/Windows-API-Code-Pack-1.1/issues/3

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

As noted in the issue description, it can cause the AccessViolationException (and probably the incorrect characters) on 64-bit Windows. You can fix it by applying the changes from the referenced pull request.

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

这篇关于TaskDialog 不适用于(或替代)Windows 10?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆