Calling Win32 ShowWindow from Java/JACOB

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.
Who is Participating?
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:

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

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

mdsrobbinsAuthor Commented:
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:


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.

mdsrobbinsAuthor Commented:
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.
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.

All Courses

From novice to tech pro — start learning today.