异常:在 Visual Studio 2022 调试器中调用 StartDoc() 时出现“找不到元素”

匿名
2024-06-21T03:16:49.64+00:00

我正在尝试使用以下 API 从桌面应用程序打印:

  • StartDoc (...)
  • StartPage (...)
  • TextOut (...)

当我使用 Visual Studio 2022 调试器运行应用程序时,StartDoc() 会引发异常,如下图所示。但是,当我直接运行.exe文件时,它可以正常工作。您能否解释一下 VS2022 调试器这种行为背后的原因?

 User's image

// Output window

Print.PrintSupport.Source.dll!00007FF8189A0417: ReturnHr(1) tid(3cd8) 80070490 Element not found.

    Msg:[onecoreuap\printscan\print\workflow\printsupport\dll\printsupportutil.cpp(574)\Print.PrintSupport.Source.dll!00007FF818975BA8: (caller: 00007FF818986287) Exception(1) tid(3cd8) 80070490 Element not found.

]

Print.PrintSupport.Source.dll!00007FF818977238: LogHr(1) tid(3cd8) 80070490 Element not found.

Exception thrown at 0x00007FF84DA95B0C (KernelBase.dll) in TWTallySCPNative.exe: WinRT originate error - 0x80070490 : 'Element not found.'.

Exception thrown at 0x00007FF84DA95B0C in TWTallySCPNative.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000DED81FC470.

此问题由:Exception: "Element Not Found" while calling StartDoc() in Visual Studio 2022 debugger - Microsoft Q&A总结而来

Windows 开发 | Windows API - Win32
0 个注释 无注释
{count} 票

1 个答案

排序依据: 非常有帮助
  1. Tong Xu - MSFT 2,546 信誉分 Microsoft 外部员工
    2024-06-21T07:20:10.7433333+00:00

    你好,

    欢迎来到 Microsoft Q&A!
    我建议您可以忽略该异常:Debug -> Windows -> Exception Settings,C++ Exception,然后取消选中winrt::hresult_error。
    11User's image

    如果答案是正确的解决方案,请单击“接受答案”并请投赞成票。如果您对此答案有其他疑问,请点击“评论”。

    注意:如果您想接收此线程的相关电子邮件通知,请按照我们文档中的步骤启用电子邮件通知

    0 个注释 无注释

你的答案

问题作者可以将答案标记为“接受的答案”,这有助于用户了解已解决作者问题的答案。