controlling program windows under ms windows

d_fishbrain used Ask the Experts™
I have to write a program which launches and interacts with an external (non java ms windows)program. I know how to launch the program (using the Process class etc.) but what I want to be able to do is either execute the program so it's program window is set to start at the top left of the screen, or to find a method which can return where the window is on the screen.

Any help would be appreciated
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
You could only do this by using a Windows flavour of Java such as J++ or you'd have to use JNI.
Mick BarryJava Developer
Top Expert 2010

Or if the program had some command line options allowing you to specify what you require.
I'd also recommend writing a DLL and using it via JNI. The MFC or Win32 calls shouldn't be too complicated if positioning is all you need.
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.


I eventually managed to get this working by writing a DLL with MS VisualC++. The calls were (as SaschaHerrmann said) not particularly difficult and easy to import into Java with the JNI. Cheers for pointing me in the right direction

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial