0

I am having the same problem with this one > Using Java Service Wrapper GUI to interact with desktop on windows

I am currently using Java Service Wrapper to wrap my Java program into a Windows Service. It has a requirement to get hold of an open Window and control it (i.e. press buttons).

I have made it an interactive service and even installed it as an admin user and still no success.

I am using JNA library to get the Windows instance which always returns null if it is running as a service but successful when triggered manually.

hWnd = User32.INSTANCE.FindWindow(0, targetWindowTitle);

One comment in that thread says , it needs to use Java RMI. Do we have examples on how to do it? Thanks!

  • What they meant was that if an interactive user started a Java GUI application that included an RMI service, the Java program running as a service could connect to it and send commands. Or vice versa. – erickson Oct 15 '17 at 02:05
  • So there is no chance that I could run a Windows Service > make this service interact with the open Windows? – CorporateSlave Oct 15 '17 at 02:09
  • No. If the interactive user runs your helper application, you can do it. – erickson Oct 15 '17 at 06:50
  • Start a desktop application which runs in the Windows tray. This application can then receive commands from the service (via whatever IPC method you want) to work with the desktop environment. – cbr Oct 15 '17 at 11:58

1 Answers1

1

I am afraid that is not possible for security reason.

Take a look at the Java Service Wrapper wrapper.ntservice.interactive property documentation at https://wrapper.tanukisoftware.com/doc/english/prop-ntservice-interactive.html

RealHowTo
  • 34,977
  • 11
  • 70
  • 85