Solved

How to minimize a child process ?

Posted on 2002-04-25
9
570 Views
Last Modified: 2012-06-21
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
Comment
Question by:soso071898
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 92

Expert Comment

by:objects
Comment Utility
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
 
LVL 92

Expert Comment

by:objects
Comment Utility
Have you tried bringing re-maximising your frame and bringing it to the front after notepad has fired up.
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
 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
 
LVL 35

Expert Comment

by:girionis
Comment Utility
 ... 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 2

Accepted Solution

by:
Andrey_Kulik earned 500 total points
Comment Utility
Hi
 
try this:
Runtime.getRuntime().exec(new String[] {"cmd", "/C", "start", "/MIN", "notepad", "c:/boot.ini"});

best regards
Andrey
0
 
LVL 2

Expert Comment

by:Andrey_Kulik
Comment Utility
After that comand you could return focus back forcedly...

I hope helps :)

0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Why not open the boot.ini file in a text component in your application window? This would also be safer and more portable.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
> Runtime.getRuntime().exec(new String[] {"cmd", "/C", "start", "/MIN", "notepad", "c:/boot.ini"});

That's what I suggested above :-)
0
 
LVL 2

Expert Comment

by:Andrey_Kulik
Comment Utility
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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now