使用 Delphi 6 的 Format() 语句以十六进制格式打印 HRESULT 的正确格式说明符?

发布于 2024-12-17 19:48:05 字数 269 浏览 4 评论 0原文

我有一个使用 DSPACK 组件库的 Delphi 6 应用程序。当特定 DirectShow 操作失败时,该库会在调试模式下打印日志行。这是相关的源代码行:

format('Error %08lX from FillBuffer!!!', [Result])

不幸的是,这一行导致 SysUtils.ConvertErrorFmt() 中出现 EConvertError 异常。尝试以十六进制格式正确打印 HRESULT 时,应使用什么正确的格式说明符?

I have a Delphi 6 application that uses the DSPACK component library. That library prints a log line when in debug mode whenever a particular DirectShow operation fails. Here's the relevant souce code line:

format('Error %08lX from FillBuffer!!!', [Result])

Unfortunately this line leads to an EConvertError Exception in SysUtils.ConvertErrorFmt(). What is the correct format specifier to use when trying to print an HRESULT correctly in hexadecimal format?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆离笙 2024-12-24 19:48:05

您传递给函数的标记 (%08lX) 无效,要将值格式化为十六进制,您必须使用 X 字符,并使用点后跟所需字符的计数,如下所示 %.8X

检查此示例

format('Error %.8X from FillBuffer!!!', [Result])

The token which you are passing (%08lX) to the function is invalid, to format a value as Hexadecimal you must use the X char, and to specify the length use a dot followed by the count of desired chars like this %.8X

Check this sample

format('Error %.8X from FillBuffer!!!', [Result])
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文