Solved

VB & Java

Posted on 1998-09-01
3
212 Views
Last Modified: 2011-08-18
I want to create a Java Applet. Drop it on a VB form. Compile it and have the applet work. Can this be done? And if so how?
0
Comment
Question by:MarkW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Expert Comment

by:Jason_G
ID: 1432433
Hi Mark,
This is about the only thing I could find in MSDN in reference to applets, and it talks about Visual Basic scripting edition.

***************************************************
*Visual Basic, Scripting Edition, and Java Applets*
***************************************************
Visual Basic, Scripting Edition, is yet another implementation of Microsoft Visual Basic;

this version allows developers to write programs—known as scripts—inside an HTML document.

A Visual Basic, Scripting Edition, program can call any public member of a Java applet. For

example, I could create a Java class.

public class Alarm extends Applet
{
    private int m_nVolume;

    public void setVolume(int v)
    {
        m_nVolume = v;
    }
}
I could then include the applet in an HTML document.

<APPLET CODE="Alarm.class" IS=ringer>
Then I could call setVolume from a script.

<SCRIPT language="VBScript">
<!--
Sub setLowVolume
    document.ringer.setVolume 10
End Sub

Sub setHighVolume
    document.ringer.setVolume 100
End Sub
-->
</SCRIPT>
The term document identifies the location of the ringer object, which is part of the web

page. What I’ve done above isn’t COM programming; I’m simply using Visual Basic, Scripting

Edition, to communicate between the web page and the applet. But as you’ll see, this

mechanism is quite useful in connecting Java applets to ActiveX controls.

I hope this helped.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com

0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 20 total points
ID: 1432434
You need IE-4 installed on the same PC.

1. Use the Web Browser control (SHDOCVW.DLL), insert this into your form.
2. Make a dummy HTML page which references the applet (just like if you were putting the applet on the web).  Save this as a file.
3. Use the Navigate function in the Web Browser control to bring up the dummy HTML page.  [it can navigate to local files as well as web sites]

Incidentally the dummy HTML file can either be distributed with your app, be on a web site somewhere or you can create a local file using the VB file functions (HTML pages are just ASCII text after all)
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1432435
Actually IE v3 will work too.
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question