0

I'm trying to build an app that takes a screenshot of specific program that's open(an external program, one that I did not code), but my research just keeps pointing me to c++. I was curious if there's a way to do this, or access Windows stuff in general from Java, or if I just need to jump to a scripting language or C. Thank you.

jagrakye
  • 215
  • 2
  • 9

1 Answers1

1

it depends, here is what I found so far.

you can access process names listed on the Task Manager via the Runtime object found here

an explanation on how to use it is on stackoverflow already here. but you need to know the name of the app you want to find, such as mspaint.exe, msword.exe, myprogram.exe, and so on...

now if you know the executable name, and the application happens to be running, you can use Java's Robot library to get a 'screenshot'. the java API library for Robot is found here and an example of how to use it can be found here. The stackoverflow answer goes into details about using Robot vs another custom tailored approach to just getting a screenshot.

Also note that the pages i linked to are for Java 7, there is also a Java 8 library found here which would be the more current version.

I usually just google "java api X" and whatever I'm looking for.

hope that helps.

Community
  • 1
  • 1
Brian W
  • 146
  • 1
  • 10