This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes [URGENT]Getting Window Handle of a JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "[URGENT]Getting Window Handle of a JFrame" Watch "[URGENT]Getting Window Handle of a JFrame" New topic

[URGENT]Getting Window Handle of a JFrame

Anirban dutta
Ranch Hand

Joined: Aug 08, 2002
Posts: 89
Dear all,
I want to how can I get the Window Handle of a window of a java application.
Actually the basic problem is I have a C++ code which I am calling through JNI. The C++ code contains code for showing message box under certain conditions. This is done by the MessageBox function of Win32 SDK library. The message box comes properly, but the problem is that it comes as minimized for the first time. When I click on the minimized icon of the message box then it pops up and then from the next time it is shown properly on the top of the Java window. I think it is basically a focus problem OR the MessageBox function requires a handle of the window over which it has to be shown. I think I could get the handle of the Java Window and pass it to the MessageBox function then it will function properly. Am I right in thinking so, or there is some other problem. Please help me in this regard.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

You want to look at the AWT Native Interface The example code there shows you exactly what you need to do.

[Jess in Action][AskingGoodQuestions]
Have you checked out Aspose?
subject: [URGENT]Getting Window Handle of a JFrame
jQuery in Action, 3rd edition