Solved

VB & Java

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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