How to capture screenshot of a window in desktop 2 when we are in desktop 1 using c# in windows 10/11

Sridhar R 1 Reputation point
2021-10-25T09:59:30.51+00:00

Can anyone please help me how to capture windows running/located in desktop 2 when we are in desktop1 using c# in windows 10/11:
Working on a automation project which has to work in desktop 2 and I have to take screenshot of each step. I tried lot of ways but all are taking desktop 1 screenshot instead of desktop2 but my automation will run in desktop2

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,294 questions
Windows 10 Compatibility
Windows 10 Compatibility
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Compatibility: The extent to which hardware or software adheres to an accepted standard.
457 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,259 questions
{count} votes