reorganized the samples, again. Moved the programs that were more test cases to the unit test directory and repackaged the unit test directory.

This commit is contained in:
clay_shooter
2006-03-18 16:21:28 +00:00
parent 288b2da21a
commit 4eb49215cb
61 changed files with 767 additions and 711 deletions

View File

@@ -0,0 +1,37 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "Math"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
'To fire this event, use RaiseEvent with the following syntax:
'RaiseEvent DoneAdd[(arg1, arg2, ... , argn)]
Public Event DoneAdd(result As Variant)
'To fire this event, use RaiseEvent with the following syntax:
'RaiseEvent DoneMult[(arg1, arg2, ... , argn)]
Public Event DoneMult(result As Variant)
Public Function Mult(in1 As Variant, in2 As Variant) As Variant
Mult = in1 * in2
RaiseEvent DoneMult(in1 * in2)
End Function
Public Function Add(in1 As Variant, in2 As Variant) As Variant
Add = in1 + in2
RaiseEvent DoneAdd(in1 + in2)
End Function
Public Function getNothing() As Variant
Set getNothing = Nothing
End Function

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,55 @@
package com.jacob.test.MathProj;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.*;
/**
* This example uses the MathTest sample VB COM DLL under
* the MathProj directory
* <pre>
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=true
* </pre>
*/
class MathTest {
public static void main(String[] args) {
MathTest me = new MathTest();
me.runTest();
}
public MathTest(){
}
public void runTest(){
// deprecated
// System.runFinalizersOnExit(true);
Dispatch test = new ActiveXComponent("MathTest.Math");
TestEvents te = new TestEvents();
DispatchEvents de = new DispatchEvents(test, te);
if (de == null) {
System.out
.println("null returned when trying to create DispatchEvents");
}
System.out.println(Dispatch.call(test, "Add", new Variant(1),
new Variant(2)));
System.out.println(Dispatch.call(test, "Mult", new Variant(2),
new Variant(2)));
Variant v = Dispatch.call(test, "Mult", new Variant(2), new Variant(2));
// this should return false
System.out.println("v.isNull=" + v.isNull());
v = Dispatch.call(test, "getNothing");
// these should return nothing
System.out.println("v.isNull=" + v.isNull());
System.out.println("v.toDispatch=" + v.toDispatch());
}
public class TestEvents {
public void DoneAdd(Variant[] args) {
System.out.println("DoneAdd called in java");
}
public void DoneMult(Variant[] args) {
System.out.println("DoneMult called in java");
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,35 @@
Type=OleDll
Class=Math; Math.cls
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\StdOle2.Tlb#OLE Automation
Startup="(None)"
HelpFile=""
Title="MathTest"
ExeName32="MathTest.dll"
Command32=""
Name="MathTest"
HelpContextID="0"
CompatibleMode="1"
CompatibleEXE32="MathTest.dll"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="Inventure America, Inc."
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=1
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
ThreadingModel=1
DebugStartupOption=0

View File

@@ -0,0 +1 @@
Math = 75, 13, 656, 554,

View File

@@ -0,0 +1,5 @@
A Simple VB COM DLL that exposes two methods and raises events.
The dll must be registered with your system
Run --> regsvr32 <path>\com\jacob\test\MathProj\MathTest.dll