Embed MFC C++ Window in JPanel?

J

jtayamai

Hi,

Does anybody know how to embed an MFC C++ Window into a signed
Applet?

I mean, referencing the handle hWnd of that window so that via JNI it
can be embedded into a JPanel or something similar.

An easy example would be a JPanel of an Applet with the Calculator
application (calc.exe) inside.

Thanks,
Iván
 
A

Alessio Stalla

Hi,

Does anybody know how to embed an MFC C++ Window into a signed
Applet?

I mean, referencing the handle hWnd of that window so that via JNI it
can be embedded into a JPanel or something similar.

An easy example would be a JPanel of an Applet with the Calculator
application (calc.exe) inside.

I seriously doubt that it's possible. AWT[1] does not expose low level
access to the screen, everything you can draw must pass through an
instance of the java.awt.Graphics class. So I can't see how a non-java
application can run inside an AWT component. Maybe you can have better
luck using SWT, which I don't know; I know they can embed the native
OS browser inside Eclipse, and if this feature is exposed somehow, you
can exploit it. However, that would probably require writing some JNI
C glue. Also, I don't think SWT can be used in applets (since Applet
is a class in java.awt), but I could be wrong.

hth,
Alessio

[1] you mentioned JPanel, which is part of Swing; Swing is a
lightweight, "pure Java" GUI library: as such, you cannot generally
embed native components inside it without problems (not even AWT
ones!). If that's possible at all, definitely you need AWT, not Swing.
 
J

jtayamai

OK Thank you very much for your help.

Assuming Applets may constitute a closed way because of their
belonging to the awt package and the need of making use of some kind
of Graphics rendering, then, what about using any other stand-alone
container JPanel, JDialog, JFrame, ... to host a MFC windows?
 
R

Roedy Green

Does anybody know how to embed an MFC C++ Window into a signed
Applet?

I think that would be extremely difficult. It would be much easier to
send C++ data to Java to display or vice versa.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"People think of security as a noun, something you go buy. In reality, it’s an abstract concept like happiness. Openness is unbelievably helpful to security."
~ James Gosling (born: 1955-05-18 age: 54), inventor of Java.
 
J

jtayamai

I think that the low-level communication approach will be a bit
complicated with already developed applications, such as calc or
mspaint, but it could be a good starting point for new applications I
can develop. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top