1

I have written a desktop application that will take a screenshot of a running application based on the selected window's handle (saved to variable intHandle) and it works fine. It only takes a screenshot of that specific application's window. It takes the screenshot and analyzes the image every second and continues to run fine even when the PC is locked or the application is not the active window.

Problem 1: When I log on through remote desktop, it appears to ignore the passed in Window Handle and now takes a screenshot of the active remote desktop window and not the specific application window.

Dim sc As New ScreenShot.ScreenCapture
Dim Screenshot As Image = sc.CaptureWindow(intHandle)

I have confirmed that that intHandle has not changed between logging on locally, switching to remotely and then back to locally. How do I get it to only take the screenshot of only the window with the intHandle when logged on through remote desktop?

Problem 2: When I disconnect from the remote desktop with the screenshot app running, It just creates black screenshots with no image but the size is still the correct size. Once I logon locally again it resumes capturing the specific application window based on the intHandle. How do I get it to continue to take screenshots of the window with the intHandle and not just create a blank, black image?

T.S.
  • 18,195
  • 11
  • 58
  • 78
  • problem 1 is understandable - remote desktop is effectively becomes the window. and then, when you disconnect, the active window is gone and you have nothing. May be – T.S. Nov 04 '16 at 21:14
  • But I am not using the active window handle but a specifically selected window handle. This way, when I am logged on locally, it is creating the screenshot of the selected window even when it is not the active window and running behind other windows. – David Hodgkins Nov 08 '16 at 15:41
  • Apparently, this is not the way RD works :-) – T.S. Nov 08 '16 at 15:42

1 Answers1

-1

Problem 2 makes sense, because of the secure concern, please check from this "PowerShell Screen Capture"

Quote: In short, this can only create correct screenshots if run from under the logged in user. Scheduled tasks qualify if users match. Running as system or local admin won't allow you to get screenshots.

Victor Lee
  • 2,467
  • 3
  • 19
  • 37