• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 630
  • Last Modified:

How to minimize a child process ?

OS: Windows 2K Pro
Java 2 Platform Std. Ed. v1.4.0

I have an application with its main window running in full screen mode using  setFullScreenWindow.
I launch a native application based on user input using
Runtime rt = Runtime.getRuntime();
Process child = rt.exec("Notepad.exe", "c:\\boot.ini" );

The problem is that once the native application (Notepad.exe) is launched, my full screen window is minimized and the focus is moved to the Notepad.exe.

The questions are:
1. How can I launch the child process in a minimized window.
2. How can I keep my main full screen window maximized, and on the top of all other application (TopMost) and has the focus?

Thanks
0
soso071898
Asked:
soso071898
  • 3
  • 3
  • 2
  • +1
1 Solution
 
objectsCommented:
Don't know of any Java API to do what you wish.
The only way I can think of is find a Windoze command that opens an application up already minimized, and call that using exec().

0
 
objectsCommented:
Have you tried bringing re-maximising your frame and bringing it to the front after notepad has fired up.
0
 
girionisCommented:
 Maybe this come in handy:

http://forum.java.sun.com/thread.jsp?forum=5&thread=9494 although they suggest that it does not always work.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
girionisCommented:
 ... and of course, as objects suggested you can monitor the "de-activated" window and bring it back to top again: http://home-1.tiscali.nl/~bmc88/java/sbook/0115.html
0
 
Andrey_KulikCommented:
Hi
 
try this:
Runtime.getRuntime().exec(new String[] {"cmd", "/C", "start", "/MIN", "notepad", "c:/boot.ini"});

best regards
Andrey
0
 
Andrey_KulikCommented:
After that comand you could return focus back forcedly...

I hope helps :)

0
 
CEHJCommented:
Why not open the boot.ini file in a text component in your application window? This would also be safer and more portable.
0
 
objectsCommented:
> Runtime.getRuntime().exec(new String[] {"cmd", "/C", "start", "/MIN", "notepad", "c:/boot.ini"});

That's what I suggested above :-)
0
 
Andrey_KulikCommented:
2objects:
your suggestion is suggestion only :)
Because java has only one way to launch other applications and this method hasnot any additional parameters to handle launching (minimazing and others), so your suggestion was obviously... but it's not solution :)

best regards
Andrey
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now