 |
|
|
I have a requirement to do something similar but in revese and I am looking for an alternative to my current method.
Currently I have a C# application where I use the Microsoft WebBrowser Control and load an HTML page into that, which in turn has an embedded Java applet in the HTML page. The applet is an image viewer. This works OK but can anyone tell me if its possible to embed a Java applet directly into the C# application without the need for the WebBrowser Control ?
The problem with the current method is whenever the C# form window is resized, which resizes the HTML page, which in turn resizes the applet (all are set to fit 100%) then a flicker can sometimes develop in the embeded HTML page. The flicker is not apparent in the applet when running in an HTML page, in a browser, during resize.
I am not sure if this is a 'feature' of the web control or not, but no amount of redraws at different points in the dynamic resize can fix this. Even if I prevent the Java window from resizing dynamically and wait until the parent window is resized and then size the applet to fit, the flicker can still occur.
Any advice or alternative ideas would be appreciated.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
I have used it as basis when I'decided to add embedding ActiveX controls within Java Application feature to Java2COM library: http://argussoftware.net/products/java2com/notes_1_4.html
I had to make couple enhancements: - retrieve HWND in JNI code (using win api) int hwnd = com.argus.activex.DispatchUtils.getHWND(Component comp) - allow other Activex control attached as a child of the HWND above (eg WindowsMediaPlayer)
Mr Valeri Shibaev Senior Developer Argus Software P/L
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
I got my code to build, but I had to change some Java side since I'm using Java 1.5 so I had to change the getHWND() method into either a native method or this.
public final static long getHWND(Component comp) { Object peer = sun.awt.windows.WToolkit.targetToPeer(comp); try { Class c = peer.getClass(); Field f = getDeclaredField(c, "hwnd"); f.setAccessible(true); Object result = f.get(peer); return ((Long)result).longValue(); } catch (Throwable t) { throw new RuntimeException(t.toString()); } }//end getHWND(Component comp)
public final static Field getDeclaredField(Class clazz, String fieldName) throws NoSuchFieldException { Class c = clazz; while (c != null && c != Object.class) { try { return c.getDeclaredField(fieldName); } catch (NoSuchFieldException e) { } c = c.getSuperclass(); } throw new NoSuchFieldException(fieldName); }//end getDeclaredField(Class clazz, String fieldName)
So now your call to initialize() crashes because the native code get NULL pUnk in CreateIEControl() function call.
public void addNotify() { super.addNotify(); synchronized(this.getTreeLock()) { long lHwnd = getHWND(comp); m_hWnd = (int) lHwnd; // <<-- Calling the above getHWND() returns a none 0 value now. initialize(m_hWnd, m_strURL); // <<-- Crashes because native CreateIEControl() refrences a NULL. } }//end addNotify()
I've spent all day trying to make this to work, please advice as what I'm doing wrong?
Thanks.
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
Please help, I got your code and if I just update the build.bat and run it I get the following errors.
my build.bat file looks like this:
----------------------- SET DEVSTUDIO=C:\Program Files\Microsoft Visual Studio\VC98 SET DEVSTUDIODLLS=C:\Program Files\Microsoft Visual Studio\VB98\ SET JDK=C:\Java\JDK\jdk1.5.0_04 %JDK%\bin\javac MyWindow.java %JDK%\bin\javah -classpath . MyWindow "%DEVSTUDIO%\bin\cl" MyWindow.CPP -Xlint:deprecation -I"%JDK%\INCLUDE" -I"%JDK%\INCLUDE\WIN32" -I"%DEVSTUDIO%\Include" -I"%DEVSTUDIO%
\ATL\Include" -i"%DEVSTUDIODLLS%" -FeMyWindow.dll -MD -LD /link /libpath:"\"%DEVSTUDIO%\lib"" user32.lib gdi32.lib -----------------------
C:\Documents and Settings\My Documents\OpenSource\javacom>build.bat
C:\Documents and Settings\My Documents\OpenSource\javacom>SET DEVSTUDIO=C:\Program Files\Microsoft Visual Studio\VC98
C:\Documents and Settings\My Documents\OpenSource\javacom>SET DEVSTUDIODLLS=C:\Program Files\Microsoft Visual Studio\VB98\
C:\Documents and Settings\My Documents\OpenSource\javacom>SET JDK=C:\Java\JDK\jdk1.5.0_04
C:\Documents and Settings\My Documents\OpenSource\javacom>C:\Java\JDK\jdk1.5.0_04\bin\javac MyWindow.java MyWindow.java:28: cannot find symbol symbol : class DrawingSurfaceInfo location: class MyWindow DrawingSurfaceInfo drawingSurfaceInfo = ((DrawingSurface)(getPeer())).getDrawingSurfaceInfo(); ^ MyWindow.java:28: cannot find symbol symbol : class DrawingSurface location: class MyWindow DrawingSurfaceInfo drawingSurfaceInfo = ((DrawingSurface)(getPeer())).getDrawingSurfaceInfo(); ^ MyWindow.java:32: cannot find symbol symbol : class Win32DrawingSurface location: class MyWindow Win32DrawingSurface win32DrawingSurface = (Win32DrawingSurface)drawingSurfaceInfo.getSurface(); ^ MyWindow.java:32: cannot find symbol symbol : class Win32DrawingSurface location: class MyWindow Win32DrawingSurface win32DrawingSurface = (Win32DrawingSurface)drawingSurfaceInfo.getSurface(); ^ Note: MyWindow.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 4 errors
C:\Documents and Settings\My Documents\OpenSource\javacom>C:\Java\JDK\jdk1.5.0_04\bin\javah -classpath . MyWindow
C:\Documents and Settings\My Documents\OpenSource\javacom>"C:\Program Files\Microsoft Visual Studio\VC98\bin\cl" MyWindow.CPP -Xlint:depr ecation -I"C:\Java\JDK\jdk1.5.0_04\INCLUDE" -I"C:\Java\JDK\jdk1.5.0_04\INCLUDE\WIN32" -I"C:\Program Files\Microsoft Visual Studio\VC98\Include" -I"C:\ Program Files\Microsoft Visual Studio\VC98\ATL\Include" -i"C:\Program Files\Microsoft Visual Studio\VB98\" -FeMyWindow.dll -MD -LD /link /libpath:"\"C :\Program Files\Microsoft Visual Studio\VC98\lib"" user32.lib gdi32.lib
THEN I get a popup error saying "This application has failed to start because mspdb60.dll was not found. Re-installing the application may fix this problem."
And also I created a new MSVC++6 project (win32 console project) for the two files MyWindow.cpp/.h and when I try to compile them I get this error.
error C2065: '_beginthread' : undeclared identifier
I've been working on this for 2 hours and I'm really stuck don't know what's causing it. Please help!
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
when i put browser on frame with my buttons and pannels ie desapear and show only when i resize frame manually how to fix it
|
| Sign In·View Thread·PermaLink | 3.50/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Is there a way embedding IECanvas in JPanel or just putting IECanvas on the ContentPane of the JDialog directly ?
|
| Sign In·View Thread·PermaLink | 2.00/5 (4 votes) |
|
|
|
 |
|
|
See: http://nothome.com/IECanvas/
"This code is based on a simpler example available at the Code Project, but with a lot of enhanchements."
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Hi guys, does anyone know how to fix problem with Java Applet inside of a page called from embeded explorer. The error message is following:
Cannot load class sun/plugin/JavaRunTime
The Bridge was installed at but the class is not there. Modify the registry key to reflect the new bridge location The key is HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in or change your CLASSPATH to include the new directory.
Example of page including applet: http://www.csc.liv.ac.uk/~frans/COMP101/AdditionalStuff/Applets/helloWorldJApplet.html
Thanx beforhand
Radim
|
| Sign In·View Thread·PermaLink | 2.75/5 (3 votes) |
|
|
|
 |
|
|
I noticed someone else posted a similar question 2 years ago, did anyone find a resolution?
If the webcontent is a form with fields, the tab key doesn't move the cursor from one field to the next.
Anyone help?
Thanks.
|
| Sign In·View Thread·PermaLink | 1.67/5 (3 votes) |
|
|
|
 |
|
|
We use Canvas as the drawing surface, such that we can embed the Internet Explorer on it. However, Canvas is a heavy weight class that can cause problem if it's overlapped with other lightweight classes. I wonder if there is other lightweight class, instead of Canvas, to embed the IE into java problem. Any help is much appreciated
|
| Sign In·View Thread·PermaLink | 2.00/5 (3 votes) |
|
|
|
 |
|
|
ive been fooling around with this all night trying to get it to compile, and what im getting now is something thats really messed up. basically, it cant find the libraries for two functions. i havent altered the c++ code at all. the MS website suggests i might need to include atl.dll, but if the distribution does not contain it, i dont see why the program should link to it. here is the error give out by compiler
/out:MyWindow.dll /dll /implib:MyWindow.lib "/libpath:C:\Program Files\DevStudio\VC\lib" user32.lib gdi32.lib MyWindow.obj Creating library MyWindow.lib and object MyWindow.exp MyWindow.obj : error LNK2001: unresolved external symbol _AtlAxGetControl@8 MyWindow.obj : error LNK2001: unresolved external symbol _AtlAxWinInit@0 MyWindow.dll : fatal error LNK1120: 2 unresolved externals
ive searched google, and it seems no one, anywhere is having this kind of problem with anything. im really at a loss here.
any help would be very much appreciated.
mike
|
| Sign In·View Thread·PermaLink | 1.50/5 (4 votes) |
|
|
|
 |
|
|
you need include atlhost.h, which is the one where AtlAxGetControl is defined. Also, what symbols does your project define? Check for _ATL_DLL. Also, make sure you do not define _ATL_DLL_IMPL (not that it makes any sense for you to do so).
robin
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi,
I downloaded code with this article and ran the same. It's good and useful thing. But what i am trying to do is go ahead and use IE's other functionalities like print, print preview and find. Here i am unable to achieve the same. When i execute execCommnad of IHTMLDocument with command ID IDM_PRINT it does not do anything. Any idea how do i get these working.
Thanks in advance Sachin
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I am able to run the code for IE canvas in my program but geting the following error while trying to use the same class in a package. I have set java.libaray.path to the location where my Mywindow.dll still geting same error. plesae, help me ASAP. it is very urget for me. thaks in advance.. ERROR is :- java.lang.UnsatisfiedLinkError void java.awt.Frame.addNotify() void java.awt.Window.show() void java.awt.Component.show(boolean) void java.awt.Component.setVisible(boolean)
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
hi all,
i can run the example. I can create a window that is the IE browser. I can even call navigate2 from Java by making it native. However when the Java object is destroyed, some COM code (i believe Release() or similar) causes an exception : cannot read from memory. It seems that when destroying the Java object the loaded DLL seems to get unloaded before the created ActiveX control gets released by COM. A proper cleanup is missing somehow. I would like to exit my application gracefully. Can anyone give hints regarding this issue? Thanks.
cheers,
Peter
XHXHXHXHXHXHXHXHXHXHXHXHXHXHX Peter Brightman XHXHXHXHXHXHXHXHXHXHXHXHXHXHX
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
No can do. IE on the Mac has been discontinued as of 6/2003. You could however, use Safari or Mozilla to display web pages. More details on that should arrive after the WWDC wich is on Monday 6/23/2003.
With JDK 1.4.1 on OS X, you can embed Coco components within Java Applications. Both WebCore (Safari's engine) and Gecko (Mozilla's engine) are available as Cocoa components. Hope this helps.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Really? I didn't know that IE had been discontinued on Macs.
Can Cocoa apps be embedded using JDK1.3.1? Can carbonized apps also be embedded?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi all,
this peace of code is great and works well on the Win32- platform.
Unfortunately, I have to do the same on the Pocket PC (Win CE 3.0), running on an ARM Processor on Compaq's iPaq.
In order to do that I have to recompile the MyWindow.cpp and to create code for the target platform using the command line compiler shipped with Microsoft eMbedded Visual Studio. At this point I get into deep trouble because I don't know exactly which header files and libraries I have to pass to the compiler. I tried to find and substitute the corresponding PocketPC .h and lib files (contained in the Pocket PC SDK), but there are always strange compilation errors. They occur while the preprocessor is analysing the source, so I assume that I'm using the wrong .h files. Or maybe the code doesn't work for the PocketPC API?
Did anybody experienced similar problems or has an idea how to solve this?
Thanks in advance. marad
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Nice Question!
Did you get an answer to this problem?
I'm having the same problem when I try to run this code on the Pocket PC - Win CE 3.0.
Hope ja,
Thank you,
Rubens
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
A problem of Dependencies is caused when deploying the project in VB .NET
it was req that put some thing manually in reqistry to register dependencies of third party ActiveX
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I've checked that the java code to get the hwnd for the IExplorer window doesn't compile with jdk 1.4. Does anyone know how to change the code to update it to jdk 1.4? Thanks in advance, Juanjo.
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
Yes there is a way to achieve this. Sun has removed the win32DrawingSurface class and replaced it with the AWT Native Interface. With this you make the paint method of a canvas native and run javah on that class.
Implement the .h file you receive and get the HWND in the way specified on http://java.sun.com/j2se/1.3/docs/guide/awt/AWT_Native_Interface.html
That should do the trick.
/Peter
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |