Embed MFC C++ Window in JPanel?

Discussion in 'Java' started by jtayamai, Sep 3, 2009.

  1. jtayamai

    jtayamai Guest

    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
     
    jtayamai, Sep 3, 2009
    #1
    1. Advertising

  2. On Sep 3, 2:00 pm, jtayamai <> 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.
     
    Alessio Stalla, Sep 3, 2009
    #2
    1. Advertising

  3. jtayamai

    jtayamai Guest

    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?
     
    jtayamai, Sep 3, 2009
    #3
  4. jtayamai

    Roedy Green Guest

    On Thu, 3 Sep 2009 05:00:44 -0700 (PDT), jtayamai
    <> 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.
     
    Roedy Green, Sep 4, 2009
    #4
  5. jtayamai

    jtayamai Guest

    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.
     
    jtayamai, Sep 8, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Beresko

    Add a JPanel to a JPanel...

    Andreas Beresko, Jul 14, 2004, in forum: Java
    Replies:
    6
    Views:
    27,153
  2. Scott McPhillips
    Replies:
    0
    Views:
    399
    Scott McPhillips
    Jul 5, 2003
  3. ringos75
    Replies:
    0
    Views:
    997
    ringos75
    Apr 14, 2005
  4. Raphael Jolivet

    [JPanel] Drop Down JPanel

    Raphael Jolivet, Jul 18, 2008, in forum: Java
    Replies:
    1
    Views:
    1,624
    John B. Matthews
    Jul 18, 2008
  5. t1m1976
    Replies:
    1
    Views:
    2,518
    t1m1976
    Nov 7, 2010
Loading...

Share This Page