From: jtayamai on
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
From: Alessio Stalla on
On Sep 3, 2:00 pm, jtayamai <jtaya...(a)googlemail.com> wrote:
> 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.
From: jtayamai on
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?

From: Roedy Green on
On Thu, 3 Sep 2009 05:00:44 -0700 (PDT), jtayamai
<jtayamai(a)googlemail.com> wrote, quoted or indirectly quoted someone
who said :

>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.
From: jtayamai on
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.