Skip to content

Cannot catch errors in CreateCaptureItemForWindow #126

@rjx-ray

Description

@rjx-ray

Whillst developing our app we are sometimes mistakenly passing a handle for a window that cannot be captured through to CreateCaptureItemForWindow (eg a child window).
I am trying to catch and debug such errors, but the catch never works, instead I get an exception.
This is my current code and the exception:

image

We hope to eliminate all such errors but if it happens in future we would like to catch rather than crash.

How can I do that?

I'm using VS2022 under Windows 11 V23H2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions