?
Solved

Calling Win32 ShowWindow from Java/JACOB

Posted on 2009-02-18
3
Medium Priority
?
1,324 Views
Last Modified: 2013-12-22
I'm seeking to call the Windows ShowWindow service from Java via JACOB to restore/minimise a Window of a given title but can't find any examples of doign this.  Can someone provide an example or an alternative means to achieve the same end.
0
Comment
Question by:mdsrobbins
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 2000 total points
ID: 23682772
Not sure why this is tagged as Groovy, but here goes...

I couldn't find a JACOB example (as they seem to have decided to move their wiki to SF, and not put any documentation up), but I found this library here:

http://jnative.free.fr/

Now, I've never used JNative, but the how-to (showing how to set it up) seems to be here:

http://jnative.free.fr/SPIP-v1-8-3/article.php3?id_article=4

And it looks like you should be able to do the following...

(maybe -- I haven't tried, and I'm not on Windows)



HWND hwnd = org.xvolks.jnative.util.User32.findWindow( null, "Window Title" ) ;
org.xvolks.jnative.util.User32.showWindow( hwnd, org.xvolks.jnative.misc.MSG.WindowsConstants.SW_MINIMIZE ) ;

Open in new window

0
 

Author Comment

by:mdsrobbins
ID: 23688625
Thanks - the code works though as you say it is not JACOB based.  

I have also located serveral other libraries that provdie similar "native" access.  Anyone interested in alternatives should look at the following website:

JavaByExample

I would, however, prefer a JACOB based solution if one exists.  The problem is that JACOB appears to need you to supply a CLSID or PROGID for the library for which it looks up the Registry etc to locate the DLL etc and there does not *appear* to be one for User32.dll.

regards
0
 

Author Comment

by:mdsrobbins
ID: 23706470
I have had confirmed elsewhere that in fact user32 and other low-level calls in kernel32 etc are NOT COM based services and therefore JACOB cannot be used so JNative or other direct call libraries is the only approach I'm aware of.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

579 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