使用 Delphi 6 的 Format() 语句以十六进制格式打印 HRESULT 的正确格式说明符?
我有一个使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您传递给函数的标记 (
%08lX
) 无效,要将值格式化为十六进制,您必须使用X
字符,并使用点后跟所需字符的计数,如下所示%.8X
检查此示例
The token which you are passing (
%08lX
) to the function is invalid, to format a value as Hexadecimal you must use theX
char, and to specify the length use a dot followed by the count of desired chars like this%.8X
Check this sample