Child window of Java using JNI

Hi All !!!
    I have a requirement, a child window of Java window having a Frame, has to be created in VC++ using JNI.

I create a window which has a Frame, in java and i am calling a JNI function which has been implemented in a DLL using VC++ 6.0. There i need a HWND parameter while creating the child window in VC++. How do i get a handle to the window that is created using java. I am using JDK1.2

For the JNI function i pass the window object which i get as a jobject in VC++.
I am right now API to create a window, but i need to use MFC classes to create a window. How is it possible to typecast a jobject to CWnd * or CMDIFrameWnd * ......

Any suggestions/comments/answers welcome
LVL 3
akalmaniAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

akalmaniAuthor Commented:
Edited text of question.
0
vivexpCommented:
0
akalmaniAuthor Commented:
HI vivexp(vivek)
   I have already mentioned what i need i.e the handle of the Java window . This site is ok not much clear.
  Please give me some working code i may give good grades
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

heyhey_Commented:
vivexp:
just a note. PLEASE post COMMENTS, if you don't have working solution.
0
nilu011700Commented:
I do not have any workin sol.
I have some suggestion. I was having similar problem of type conversion from Java to C++. The best way I found is to have a wrapper method at Java side which does the conversion to the useful type either at JNI or Java.

Before calling native method;  call the Java method which does type conversion and same for JNI to Java If u need to return some values.

I hope this would help.
Have fun!!
0
heyhey_Commented:
Proposed Answer
From: nilu
Date: Tuesday, January 18 2000 - 04:16AM PST

I do not have any workin sol.
I have some suggestion


so why don't you POST COMMENT instead of ANSWER ?
0
jini36Commented:
just curious , heyhey R u monitoring this site ???

Enjoy!
0
heyhey_Commented:
I just enjoy solving problems :)

when I have suggestion, I post it as comment ...
I haven't posted an ANSWER, before the questioner has solved his problem for more than several months ...

Enjoy ! :)
0
akalmaniAuthor Commented:
HI All !!
   Thanks for u r comments but i have already told i want a working code. I am not good in java programming but good in MFC.
  Hope u sent me solution as soon as possible
  HeyHey its a challenge for u. U just tell me how to get the handle of the window may  be through window class present in java or through any API
0
vivexpCommented:
Hi,

Since handle to the window is an memory address or pointer to a window. i dont think u can get it in java bcoz java doesnt have pointer concept. probably u can use the object of that window for  interfacing.

Correct me if im wrong!!!!!

try out...
0
heyhey_Commented:
http://www.javaworld.com/javaworld/jw-10-1999/jw-10-jni-2.html

GUI and beyond
JNI does have a serious limitation when it comes to extending Java's GUI: there is no standard way for getting native window handles from AWT components. Each VM may implement its AWT differently, and store the window handle in a different place. Future versions of the VM may handle windows in still different ways, ways that cannot be predicted with any certainty right now. With Java 2 platform VMs just starting to get a foothold (without this feature), I don't expect to see a standard way for doing this anytime soon.


you can still cheat - every Window object has associated Text, so you can go through all the available Window objects and search for your Frame's title ... I don't know the Win32 API very well, but should be possible :)

0
akalmaniAuthor Commented:
Hi ALL !!
     Thanks for u r help !!! HeyHey.
i know the solution through FindWindow() but this is not the proper solution. I know that JDK1.3 has JAWT where i can get the window handle.
But as i am using JDK1.2 i cannot accept that.
 
 But i will give u points as i have no other solution send me as an answer.

Once again thanks for all and bye
0
heyhey_Commented:
Win32 FindWindow is the only possible solution for 1.1 & 1.2 .. I haven't used 1.3 for the moment

btw. you can accept my comment as answer :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.