0

I have a java application running on Windows (javaw.exe) and I would like to close the child windows through a C# application. I can see the child windows through task manager under the Applications tab but when I right-click on the child windows and click Go To Process, it takes me to the javaw.exe process running under the Processes tab.

I have tried iterating through active processes to close each window however, I am unable to find the child java windows and only can see the javaw process.

Process[] childProcesses = Process.GetProcessesByName("javaw");

I have searched the internet forums and have not been able to find a proper solution that deals with a java application running on windows to be be dealt with using C#. I'm sure there is an obvious solution so any help is much appreciated. Thanks.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364

2 Answers2

0

If I understand correctly your problem, you want to close one or more window among many of a java application ?

You won't have child processes on javaw, you only have threads running inside the JVM. Maybe using the Threads property of the process object could help.

But even doing that, all graphic objects in a java application are rules by the AWT Thread. Killing it will mean closing all the windows.

So i don't think it's possible to do what you want to do :/

SebVb
  • 187
  • 1
  • 3
  • 14
0

Could you try to get handle of the child window and send message to it using P\Invoke methods and calling win32 api?

Maybe this answer can cover this idea:Cannot use pinvoke to send WM_CLOSE to a Windows Explorer window

Community
  • 1
  • 1
Andrey Ischencko
  • 800
  • 1
  • 6
  • 18