Solved

VB & Java

Posted on 1998-09-01
3
197 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now