1761727 converted unit test programs to JUnit tests and updated the build targets

This commit is contained in:
clay_shooter
2007-07-27 03:28:44 +00:00
parent bfdc36ad30
commit 78c7ddf199
71 changed files with 1459 additions and 1257 deletions

View File

@@ -0,0 +1,159 @@
package com.jacob.test;
import java.net.URL;
import junit.framework.TestCase;
import com.jacob.com.JacobObject;
/**
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options. Or try these:
*
* <pre>
* -Djava.library.path=d:/jacob/release/x86
* -Dcom.jacob.autogc=false
* -Dcom.jacob.debug=false
* -Xcheck:jni
* </pre>
*/
public class BaseTestCase extends TestCase {
protected void setUp() {
// verify we have run with the dll in the lib path
try {
JacobObject foo = new JacobObject();
if (foo == null) {
fail("Failed basic sanity test: Can't create JacobObject (-D<java.library.path=xxx>)");
}
} catch (UnsatisfiedLinkError ule) {
fail("Did you remember to run with the jacob.dll in the libpath ?");
}
}
/**
* this test exists just to test the setup.
*/
public void testSetup(){
JacobObject foo = new JacobObject();
assertNotNull(foo);
}
/**
*
* @return a simple VB script that generates the result "3"
*/
public String getSampleVPScriptForEval() {
return "1+(2*4)-3";
}
/**
* Converts the class name into a path and appends the resource name.
* Used to derive the path to a resouce in the file system
* where the resource is co-located with the referenced class.
*
* @param resourceName
* @param classInSamePackageAsResource
* @return a class loader compatible fully qualified file system path to a resource
*/
public String getJavaFilePathToPackageResource(String resourceName,
Class classInSamePackageAsResource) {
String classPackageName = classInSamePackageAsResource.getName();
int i = classPackageName.lastIndexOf('.');
if (i == -1) {
classPackageName = "";
} else {
classPackageName = classPackageName.substring(0,i);
}
// change all "." to ^ for later conversion to "/" so we can append resource names with "."
classPackageName = classPackageName.replace('.', '^');
System.out.println("classPackageName:" + classPackageName);
String fullPathToResource = (classPackageName.length() > 0 ? classPackageName
+ "^"
: "")
+ resourceName;
fullPathToResource = fullPathToResource.replace('^', '/');
System.out.println("fullPathToResource:" + fullPathToResource);
URL urlToLibrary =
classInSamePackageAsResource.getClassLoader().getResource(fullPathToResource);
assertNotNull(urlToLibrary);
String fullPathToResourceAsFile = urlToLibrary.getFile();
System.out.println("url to library: "+urlToLibrary);
System.out.println("fullPathToResourceAsFile: "+fullPathToResourceAsFile);
return fullPathToResourceAsFile;
}
/**
* Converts the class name into a path and appends the resource name.
* Used to derive the path to a resouce in the file system
* where the resource is co-located with the referenced class.
*
* @param resourceName
* @param classInSamePackageAsResource
* @return returns the path in the file system of the requested resource in windows c
* compatible format
*/
public String getWindowsFilePathToPackageResource(
String resourceName, Class classInSamePackageAsResource) {
String javaFilePath = getJavaFilePathToPackageResource(
resourceName, classInSamePackageAsResource);
javaFilePath = javaFilePath.replace('/', '\\');
return javaFilePath.substring(1);
}
/**
*
* @param resourceName
* @param classInSamePackageAsResource
* @return a resource located in the same package as the passed in class
*/
public Object getPackageResource(String resourceName,
Class classInSamePackageAsResource) {
String fullPathToResource = getJavaFilePathToPackageResource(resourceName,
classInSamePackageAsResource);
ClassLoader localClassLoader = classInSamePackageAsResource
.getClassLoader();
if (null == localClassLoader) {
return ClassLoader.getSystemResource(fullPathToResource);
} else {
return localClassLoader.getResource(fullPathToResource);
}
}
/**
* load a library from same place in the file system that the class was
* loaded from.
* <p>
* This is an attempt to let unit tests run without having to run
* regsvr32.
*
* @param libraryName
* @param classInSamePackageAsResource
*/
public void loadLibraryFromClassPackage(String libraryName,
Class classInSamePackageAsResource) {
String libraryNameWithSuffix = "";
String fullLibraryNameWithPath = "";
if (libraryName != null && libraryName.endsWith("dll")) {
libraryNameWithSuffix = libraryName;
} else if (libraryName != null) {
libraryNameWithSuffix = libraryName + ".dll";
} else {
fail("can't create full library name " + libraryName);
}
// generate the path the classloader would use to find this on the classpath
fullLibraryNameWithPath = getJavaFilePathToPackageResource(
libraryNameWithSuffix, classInSamePackageAsResource);
System.load(fullLibraryNameWithPath);
// requires that the dll be on the library path
//System.loadLibrary(fullLibraryNameWithPath);
}
}

View File

@@ -1,37 +0,0 @@
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

View File

@@ -1,55 +0,0 @@
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
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
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");
}
}
}

View File

@@ -1,35 +0,0 @@
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

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

View File

@@ -1,5 +0,0 @@
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

View File

@@ -1,67 +0,0 @@
// Face.cpp : Implementation of CMultiFaceApp and DLL registration.
#include "stdafx.h"
#include "MultiFace.h"
#include "Face.h"
/////////////////////////////////////////////////////////////////////////////
//
STDMETHODIMP Face::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IFace1,
&IID_IFace2,
&IID_IFace3,
};
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
{
if (InlineIsEqualGUID(*arr[i],riid))
return S_OK;
}
return S_FALSE;
}
STDMETHODIMP Face::get_Face1Name(BSTR *pVal)
{
// TODO: Add your implementation code here
*pVal = name1;
return S_OK;
}
STDMETHODIMP Face::put_Face1Name(BSTR newVal)
{
// TODO: Add your implementation code here
name1 = newVal;
return S_OK;
}
STDMETHODIMP Face::get_Face2Nam(BSTR *pVal)
{
// TODO: Add your implementation code here
*pVal = name2;
return S_OK;
}
STDMETHODIMP Face::put_Face2Nam(BSTR newVal)
{
// TODO: Add your implementation code here
name2 = newVal;
return S_OK;
}
STDMETHODIMP Face::get_Face3Name(BSTR *pVal)
{
// TODO: Add your implementation code here
*pVal = name3;
return S_OK;
}
STDMETHODIMP Face::put_Face3Name(BSTR newVal)
{
// TODO: Add your implementation code here
name3 = newVal;
return S_OK;
}

View File

@@ -1,63 +0,0 @@
// Face.h: Definition of the Face class
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FACE_H__9BF24413_B2E0_11D4_A695_00104BFF3241__INCLUDED_)
#define AFX_FACE_H__9BF24413_B2E0_11D4_A695_00104BFF3241__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// Face
class Face :
public IDispatchImpl<IFace1, &IID_IFace1, &LIBID_MULTIFACELib>,
public IDispatchImpl<IFace2, &IID_IFace2, &LIBID_MULTIFACELib>,
public IDispatchImpl<IFace3, &IID_IFace3, &LIBID_MULTIFACELib>,
public ISupportErrorInfo,
public CComObjectRoot,
public CComCoClass<Face,&CLSID_Face>
{
// IFace1
private:
CComBSTR name1;
// IFace2
CComBSTR name2;
// IFace3
CComBSTR name3;
public:
Face() {}
BEGIN_COM_MAP(Face)
COM_INTERFACE_ENTRY2(IDispatch, IFace1)
COM_INTERFACE_ENTRY(IFace1)
COM_INTERFACE_ENTRY(IFace2)
COM_INTERFACE_ENTRY(IFace3)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
//DECLARE_NOT_AGGREGATABLE(Face)
// Remove the comment from the line above if you don't want your object to
// support aggregation.
DECLARE_REGISTRY_RESOURCEID(IDR_Face)
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
public:
STDMETHOD(get_Face3Name)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Face3Name)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Face2Nam)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Face2Nam)(/*[in]*/ BSTR newVal);
STDMETHOD(get_Face1Name)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_Face1Name)(/*[in]*/ BSTR newVal);
};
#endif // !defined(AFX_FACE_H__9BF24413_B2E0_11D4_A695_00104BFF3241__INCLUDED_)

View File

@@ -1,23 +0,0 @@
HKCR
{
MultiFace.Face.1 = s 'Face Class'
{
CLSID = s '{9BF24412-B2E0-11D4-A695-00104BFF3241}'
}
MultiFace.Face = s 'Face Class'
{
CLSID = s '{9BF24412-B2E0-11D4-A695-00104BFF3241}'
}
NoRemove CLSID
{
ForceRemove {9BF24412-B2E0-11D4-A695-00104BFF3241} = s 'Face Class'
{
ProgID = s 'MultiFace.Face.1'
VersionIndependentProgID = s 'MultiFace.Face'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'both'
}
}
}
}

View File

@@ -1,72 +0,0 @@
// MultiFace.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f MultiFaceps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "MultiFace.h"
#include "MultiFace_i.c"
#include "Face.h"
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Face, Face)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_MULTIFACELib);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
return _Module.UnregisterServer(TRUE);
}

View File

@@ -1,9 +0,0 @@
; MultiFace.def : Declares the module parameters.
LIBRARY "MultiFace.DLL"
EXPORTS
DllCanUnloadNow @1 PRIVATE
DllGetClassObject @2 PRIVATE
DllRegisterServer @3 PRIVATE
DllUnregisterServer @4 PRIVATE

View File

@@ -1,323 +0,0 @@
# Microsoft Developer Studio Project File - Name="MultiFace" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=MultiFace - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "MultiFace.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "MultiFace.mak" CFG="MultiFace - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "MultiFace - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "MultiFace - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "MultiFace - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "MultiFace - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "MultiFace - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "MultiFace - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "MultiFace - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# Begin Custom Build - Performing registration
OutDir=.\Debug
TargetPath=.\Debug\MultiFace.dll
InputPath=.\Debug\MultiFace.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "MultiFace - Win32 Unicode Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugU"
# PROP BASE Intermediate_Dir "DebugU"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugU"
# PROP Intermediate_Dir "DebugU"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# Begin Custom Build - Performing registration
OutDir=.\DebugU
TargetPath=.\DebugU\MultiFace.dll
InputPath=.\DebugU\MultiFace.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
# End Custom Build
!ELSEIF "$(CFG)" == "MultiFace - Win32 Release MinSize"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseMinSize"
# PROP BASE Intermediate_Dir "ReleaseMinSize"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseMinSize"
# PROP Intermediate_Dir "ReleaseMinSize"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseMinSize
TargetPath=.\ReleaseMinSize\MultiFace.dll
InputPath=.\ReleaseMinSize\MultiFace.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "MultiFace - Win32 Release MinDependency"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseMinDependency"
# PROP BASE Intermediate_Dir "ReleaseMinDependency"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseMinDependency"
# PROP Intermediate_Dir "ReleaseMinDependency"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseMinDependency
TargetPath=.\ReleaseMinDependency\MultiFace.dll
InputPath=.\ReleaseMinDependency\MultiFace.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "MultiFace - Win32 Unicode Release MinSize"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseUMinSize"
# PROP BASE Intermediate_Dir "ReleaseUMinSize"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseUMinSize"
# PROP Intermediate_Dir "ReleaseUMinSize"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseUMinSize
TargetPath=.\ReleaseUMinSize\MultiFace.dll
InputPath=.\ReleaseUMinSize\MultiFace.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
# End Custom Build
!ELSEIF "$(CFG)" == "MultiFace - Win32 Unicode Release MinDependency"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseUMinDependency"
# PROP BASE Intermediate_Dir "ReleaseUMinDependency"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseUMinDependency"
# PROP Intermediate_Dir "ReleaseUMinDependency"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseUMinDependency
TargetPath=.\ReleaseUMinDependency\MultiFace.dll
InputPath=.\ReleaseUMinDependency\MultiFace.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
# End Custom Build
!ENDIF
# Begin Target
# Name "MultiFace - Win32 Debug"
# Name "MultiFace - Win32 Unicode Debug"
# Name "MultiFace - Win32 Release MinSize"
# Name "MultiFace - Win32 Release MinDependency"
# Name "MultiFace - Win32 Unicode Release MinSize"
# Name "MultiFace - Win32 Unicode Release MinDependency"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Face.cpp
# End Source File
# Begin Source File
SOURCE=.\MultiFace.cpp
# End Source File
# Begin Source File
SOURCE=.\MultiFace.def
# End Source File
# Begin Source File
SOURCE=.\MultiFace.idl
# ADD MTL /tlb ".\MultiFace.tlb" /h "MultiFace.h" /iid "MultiFace_i.c" /Oicf
# End Source File
# Begin Source File
SOURCE=.\MultiFace.rc
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Face.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\Face.rgs
# End Source File
# End Group
# End Target
# End Project

View File

@@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "MultiFace"=.\MultiFace.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -1,571 +0,0 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 5.01.0164 */
/* at Sun Nov 05 01:12:47 2000
*/
/* Compiler settings for D:\jacob_15\samples\test\atl\MultiFace\MultiFace.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 440
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __MultiFace_h__
#define __MultiFace_h__
#ifdef __cplusplus
extern "C"{
#endif
/* Forward Declarations */
#ifndef __IFace1_FWD_DEFINED__
#define __IFace1_FWD_DEFINED__
typedef interface IFace1 IFace1;
#endif /* __IFace1_FWD_DEFINED__ */
#ifndef __IFace2_FWD_DEFINED__
#define __IFace2_FWD_DEFINED__
typedef interface IFace2 IFace2;
#endif /* __IFace2_FWD_DEFINED__ */
#ifndef __IFace3_FWD_DEFINED__
#define __IFace3_FWD_DEFINED__
typedef interface IFace3 IFace3;
#endif /* __IFace3_FWD_DEFINED__ */
#ifndef __Face_FWD_DEFINED__
#define __Face_FWD_DEFINED__
#ifdef __cplusplus
typedef class Face Face;
#else
typedef struct Face Face;
#endif /* __cplusplus */
#endif /* __Face_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void __RPC_FAR * );
#ifndef __IFace1_INTERFACE_DEFINED__
#define __IFace1_INTERFACE_DEFINED__
/* interface IFace1 */
/* [unique][helpstring][dual][uuid][object] */
EXTERN_C const IID IID_IFace1;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("9BF2440F-B2E0-11D4-A695-00104BFF3241")
IFace1 : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Face1Name(
/* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Face1Name(
/* [in] */ BSTR newVal) = 0;
};
#else /* C style interface */
typedef struct IFace1Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IFace1 __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IFace1 __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IFace1 __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IFace1 __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IFace1 __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IFace1 __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IFace1 __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Face1Name )(
IFace1 __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *pVal);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Face1Name )(
IFace1 __RPC_FAR * This,
/* [in] */ BSTR newVal);
END_INTERFACE
} IFace1Vtbl;
interface IFace1
{
CONST_VTBL struct IFace1Vtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IFace1_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IFace1_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IFace1_Release(This) \
(This)->lpVtbl -> Release(This)
#define IFace1_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IFace1_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IFace1_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IFace1_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IFace1_get_Face1Name(This,pVal) \
(This)->lpVtbl -> get_Face1Name(This,pVal)
#define IFace1_put_Face1Name(This,newVal) \
(This)->lpVtbl -> put_Face1Name(This,newVal)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE IFace1_get_Face1Name_Proxy(
IFace1 __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *pVal);
void __RPC_STUB IFace1_get_Face1Name_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE IFace1_put_Face1Name_Proxy(
IFace1 __RPC_FAR * This,
/* [in] */ BSTR newVal);
void __RPC_STUB IFace1_put_Face1Name_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IFace1_INTERFACE_DEFINED__ */
#ifndef __IFace2_INTERFACE_DEFINED__
#define __IFace2_INTERFACE_DEFINED__
/* interface IFace2 */
/* [unique][helpstring][dual][uuid][object] */
EXTERN_C const IID IID_IFace2;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("9BF24410-B2E0-11D4-A695-00104BFF3241")
IFace2 : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Face2Nam(
/* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Face2Nam(
/* [in] */ BSTR newVal) = 0;
};
#else /* C style interface */
typedef struct IFace2Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IFace2 __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IFace2 __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IFace2 __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IFace2 __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IFace2 __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IFace2 __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IFace2 __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Face2Nam )(
IFace2 __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *pVal);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Face2Nam )(
IFace2 __RPC_FAR * This,
/* [in] */ BSTR newVal);
END_INTERFACE
} IFace2Vtbl;
interface IFace2
{
CONST_VTBL struct IFace2Vtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IFace2_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IFace2_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IFace2_Release(This) \
(This)->lpVtbl -> Release(This)
#define IFace2_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IFace2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IFace2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IFace2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IFace2_get_Face2Nam(This,pVal) \
(This)->lpVtbl -> get_Face2Nam(This,pVal)
#define IFace2_put_Face2Nam(This,newVal) \
(This)->lpVtbl -> put_Face2Nam(This,newVal)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE IFace2_get_Face2Nam_Proxy(
IFace2 __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *pVal);
void __RPC_STUB IFace2_get_Face2Nam_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE IFace2_put_Face2Nam_Proxy(
IFace2 __RPC_FAR * This,
/* [in] */ BSTR newVal);
void __RPC_STUB IFace2_put_Face2Nam_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IFace2_INTERFACE_DEFINED__ */
#ifndef __IFace3_INTERFACE_DEFINED__
#define __IFace3_INTERFACE_DEFINED__
/* interface IFace3 */
/* [unique][helpstring][dual][uuid][object] */
EXTERN_C const IID IID_IFace3;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("9BF24411-B2E0-11D4-A695-00104BFF3241")
IFace3 : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Face3Name(
/* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Face3Name(
/* [in] */ BSTR newVal) = 0;
};
#else /* C style interface */
typedef struct IFace3Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IFace3 __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IFace3 __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IFace3 __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )(
IFace3 __RPC_FAR * This,
/* [out] */ UINT __RPC_FAR *pctinfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )(
IFace3 __RPC_FAR * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )(
IFace3 __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID __RPC_FAR *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )(
IFace3 __RPC_FAR * This,
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
/* [out] */ VARIANT __RPC_FAR *pVarResult,
/* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
/* [out] */ UINT __RPC_FAR *puArgErr);
/* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Face3Name )(
IFace3 __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *pVal);
/* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Face3Name )(
IFace3 __RPC_FAR * This,
/* [in] */ BSTR newVal);
END_INTERFACE
} IFace3Vtbl;
interface IFace3
{
CONST_VTBL struct IFace3Vtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IFace3_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IFace3_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IFace3_Release(This) \
(This)->lpVtbl -> Release(This)
#define IFace3_GetTypeInfoCount(This,pctinfo) \
(This)->lpVtbl -> GetTypeInfoCount(This,pctinfo)
#define IFace3_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
(This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo)
#define IFace3_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
(This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId)
#define IFace3_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
(This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
#define IFace3_get_Face3Name(This,pVal) \
(This)->lpVtbl -> get_Face3Name(This,pVal)
#define IFace3_put_Face3Name(This,newVal) \
(This)->lpVtbl -> put_Face3Name(This,newVal)
#endif /* COBJMACROS */
#endif /* C style interface */
/* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE IFace3_get_Face3Name_Proxy(
IFace3 __RPC_FAR * This,
/* [retval][out] */ BSTR __RPC_FAR *pVal);
void __RPC_STUB IFace3_get_Face3Name_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
/* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE IFace3_put_Face3Name_Proxy(
IFace3 __RPC_FAR * This,
/* [in] */ BSTR newVal);
void __RPC_STUB IFace3_put_Face3Name_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IFace3_INTERFACE_DEFINED__ */
#ifndef __MULTIFACELib_LIBRARY_DEFINED__
#define __MULTIFACELib_LIBRARY_DEFINED__
/* library MULTIFACELib */
/* [helpstring][version][uuid] */
EXTERN_C const IID LIBID_MULTIFACELib;
EXTERN_C const CLSID CLSID_Face;
#ifdef __cplusplus
class DECLSPEC_UUID("9BF24412-B2E0-11D4-A695-00104BFF3241")
Face;
#endif
#endif /* __MULTIFACELib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * );
unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * );
void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * );
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,70 +0,0 @@
// MultiFace.idl : IDL source for MultiFace.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (MultiFace.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(9BF2440F-B2E0-11D4-A695-00104BFF3241),
dual,
helpstring("IFace1 Interface"),
pointer_default(unique)
]
interface IFace1 : IDispatch
{
[propget, id(1), helpstring("property Face1Name")] HRESULT Face1Name([out, retval] BSTR *pVal);
[propput, id(1), helpstring("property Face1Name")] HRESULT Face1Name([in] BSTR newVal);
};
[
object,
uuid(9BF24410-B2E0-11D4-A695-00104BFF3241),
dual,
helpstring("IFace2 Interface"),
pointer_default(unique)
]
interface IFace2 : IDispatch
{
[propget, id(1), helpstring("property Face2Nam")] HRESULT Face2Nam([out, retval] BSTR *pVal);
[propput, id(1), helpstring("property Face2Nam")] HRESULT Face2Nam([in] BSTR newVal);
};
[
object,
uuid(9BF24411-B2E0-11D4-A695-00104BFF3241),
dual,
helpstring("IFace3 Interface"),
pointer_default(unique)
]
interface IFace3 : IDispatch
{
[propget, id(1), helpstring("property Face3Name")] HRESULT Face3Name([out, retval] BSTR *pVal);
[propput, id(1), helpstring("property Face3Name")] HRESULT Face3Name([in] BSTR newVal);
};
[
uuid(9BF24403-B2E0-11D4-A695-00104BFF3241),
version(1.0),
helpstring("MultiFace 1.0 Type Library")
]
library MULTIFACELib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(9BF24412-B2E0-11D4-A695-00104BFF3241),
helpstring("Face Class")
]
coclass Face
{
[default] interface IFace1;
interface IFace2;
interface IFace3;
};
};

View File

@@ -1,48 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: MultiFace - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\TEMP\RSP335.tmp" with contents
[
/nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fp"Debug/MultiFace.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"D:\jacob_15\samples\test\atl\MultiFace\MultiFace.cpp"
"D:\jacob_15\samples\test\atl\MultiFace\Face.cpp"
]
Creating command line "cl.exe @C:\TEMP\RSP335.tmp"
Creating temporary file "C:\TEMP\RSP336.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"Debug/MultiFace.pdb" /debug /machine:I386 /def:".\MultiFace.def" /out:"Debug/MultiFace.dll" /implib:"Debug/MultiFace.lib" /pdbtype:sept
.\Debug\StdAfx.obj
.\Debug\MultiFace.obj
.\Debug\MultiFace.res
.\Debug\Face.obj
]
Creating command line "link.exe @C:\TEMP\RSP336.tmp"
Creating temporary file "C:\TEMP\RSP337.bat" with contents
[
@echo off
regsvr32 /s /c ".\Debug\MultiFace.dll"
echo regsvr32 exec. time > ".\Debug\regsvr32.trg"
]
Creating command line "C:\TEMP\RSP337.bat"
Compiling...
MultiFace.cpp
Face.cpp
Generating Code...
Linking...
<h3>Output Window</h3>
Performing registration
RegSvr32: DllRegisterServer in .\Debug\MultiFace.dll succeeded.
<h3>Results</h3>
MultiFace.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@@ -1,125 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"1 TYPELIB ""MultiFace.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "MultiFace Module\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "MultiFace\0"
VALUE "LegalCopyright", "Copyright 2000\0"
VALUE "OriginalFilename", "MultiFace.DLL\0"
VALUE "ProductName", "MultiFace Module\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "OLESelfRegister", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_Face REGISTRY DISCARDABLE "Face.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_PROJNAME "MultiFace"
IDS_FACE_DESC "Face Class"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "MultiFace.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -1,56 +0,0 @@
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 5.01.0164 */
/* at Sun Nov 05 01:12:47 2000
*/
/* Compiler settings for D:\jacob_15\samples\test\atl\MultiFace\MultiFace.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID IID_IFace1 = {0x9BF2440F,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}};
const IID IID_IFace2 = {0x9BF24410,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}};
const IID IID_IFace3 = {0x9BF24411,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}};
const IID LIBID_MULTIFACELib = {0x9BF24403,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}};
const CLSID CLSID_Face = {0x9BF24412,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}};
#ifdef __cplusplus
}
#endif

View File

@@ -1,570 +0,0 @@
/* this ALWAYS GENERATED file contains the proxy stub code */
/* File created by MIDL compiler version 5.01.0164 */
/* at Sun Nov 05 01:12:47 2000
*/
/* Compiler settings for D:\jacob_15\samples\test\atl\MultiFace\MultiFace.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
#define USE_STUBLESS_PROXY
/* verify that the <rpcproxy.h> version is high enough to compile this file*/
#ifndef __REDQ_RPCPROXY_H_VERSION__
#define __REQUIRED_RPCPROXY_H_VERSION__ 440
#endif
#include "rpcproxy.h"
#ifndef __RPCPROXY_H_VERSION__
#error this stub requires an updated version of <rpcproxy.h>
#endif // __RPCPROXY_H_VERSION__
#include "MultiFace.h"
#define TYPE_FORMAT_STRING_SIZE 55
#define PROC_FORMAT_STRING_SIZE 57
typedef struct _MIDL_TYPE_FORMAT_STRING
{
short Pad;
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
} MIDL_TYPE_FORMAT_STRING;
typedef struct _MIDL_PROC_FORMAT_STRING
{
short Pad;
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
} MIDL_PROC_FORMAT_STRING;
extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;
extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;
/* Object interface: IUnknown, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IDispatch, ver. 0.0,
GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IFace1, ver. 0.0,
GUID={0x9BF2440F,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}} */
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IFace1_ServerInfo;
#pragma code_seg(".orpc")
static const unsigned short IFace1_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0,
28
};
static const MIDL_SERVER_INFO IFace1_ServerInfo =
{
&Object_StubDesc,
0,
__MIDL_ProcFormatString.Format,
&IFace1_FormatStringOffsetTable[-3],
0,
0,
0,
0
};
static const MIDL_STUBLESS_PROXY_INFO IFace1_ProxyInfo =
{
&Object_StubDesc,
__MIDL_ProcFormatString.Format,
&IFace1_FormatStringOffsetTable[-3],
0,
0,
0
};
CINTERFACE_PROXY_VTABLE(9) _IFace1ProxyVtbl =
{
&IFace1_ProxyInfo,
&IID_IFace1,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
0 /* IDispatch_Invoke_Proxy */ ,
(void *)-1 /* IFace1::get_Face1Name */ ,
(void *)-1 /* IFace1::put_Face1Name */
};
static const PRPC_STUB_FUNCTION IFace1_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
NdrStubCall2,
NdrStubCall2
};
CInterfaceStubVtbl _IFace1StubVtbl =
{
&IID_IFace1,
&IFace1_ServerInfo,
9,
&IFace1_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
/* Object interface: IFace2, ver. 0.0,
GUID={0x9BF24410,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}} */
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IFace2_ServerInfo;
#pragma code_seg(".orpc")
static const unsigned short IFace2_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0,
28
};
static const MIDL_SERVER_INFO IFace2_ServerInfo =
{
&Object_StubDesc,
0,
__MIDL_ProcFormatString.Format,
&IFace2_FormatStringOffsetTable[-3],
0,
0,
0,
0
};
static const MIDL_STUBLESS_PROXY_INFO IFace2_ProxyInfo =
{
&Object_StubDesc,
__MIDL_ProcFormatString.Format,
&IFace2_FormatStringOffsetTable[-3],
0,
0,
0
};
CINTERFACE_PROXY_VTABLE(9) _IFace2ProxyVtbl =
{
&IFace2_ProxyInfo,
&IID_IFace2,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
0 /* IDispatch_Invoke_Proxy */ ,
(void *)-1 /* IFace2::get_Face2Nam */ ,
(void *)-1 /* IFace2::put_Face2Nam */
};
static const PRPC_STUB_FUNCTION IFace2_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
NdrStubCall2,
NdrStubCall2
};
CInterfaceStubVtbl _IFace2StubVtbl =
{
&IID_IFace2,
&IFace2_ServerInfo,
9,
&IFace2_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
/* Object interface: IFace3, ver. 0.0,
GUID={0x9BF24411,0xB2E0,0x11D4,{0xA6,0x95,0x00,0x10,0x4B,0xFF,0x32,0x41}} */
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IFace3_ServerInfo;
#pragma code_seg(".orpc")
extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[1];
static const MIDL_STUB_DESC Object_StubDesc =
{
0,
NdrOleAllocate,
NdrOleFree,
0,
0,
0,
0,
0,
__MIDL_TypeFormatString.Format,
1, /* -error bounds_check flag */
0x20000, /* Ndr library version */
0,
0x50100a4, /* MIDL Version 5.1.164 */
0,
UserMarshalRoutines,
0, /* notify & notify_flag routine table */
1, /* Flags */
0, /* Reserved3 */
0, /* Reserved4 */
0 /* Reserved5 */
};
static const unsigned short IFace3_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0,
28
};
static const MIDL_SERVER_INFO IFace3_ServerInfo =
{
&Object_StubDesc,
0,
__MIDL_ProcFormatString.Format,
&IFace3_FormatStringOffsetTable[-3],
0,
0,
0,
0
};
static const MIDL_STUBLESS_PROXY_INFO IFace3_ProxyInfo =
{
&Object_StubDesc,
__MIDL_ProcFormatString.Format,
&IFace3_FormatStringOffsetTable[-3],
0,
0,
0
};
CINTERFACE_PROXY_VTABLE(9) _IFace3ProxyVtbl =
{
&IFace3_ProxyInfo,
&IID_IFace3,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
0 /* IDispatch_Invoke_Proxy */ ,
(void *)-1 /* IFace3::get_Face3Name */ ,
(void *)-1 /* IFace3::put_Face3Name */
};
static const PRPC_STUB_FUNCTION IFace3_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
NdrStubCall2,
NdrStubCall2
};
CInterfaceStubVtbl _IFace3StubVtbl =
{
&IID_IFace3,
&IFace3_ServerInfo,
9,
&IFace3_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
#pragma data_seg(".rdata")
static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[1] =
{
{
BSTR_UserSize
,BSTR_UserMarshal
,BSTR_UserUnmarshal
,BSTR_UserFree
}
};
#if !defined(__RPC_WIN32__)
#error Invalid build platform for this stub.
#endif
#if !(TARGET_IS_NT40_OR_LATER)
#error You need a Windows NT 4.0 or later to run this stub because it uses these features:
#error -Oif or -Oicf, [wire_marshal] or [user_marshal] attribute, more than 32 methods in the interface.
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
#error This app will die there with the RPC_X_WRONG_STUB_VERSION error.
#endif
static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
{
0,
{
/* Procedure get_Face3Name */
/* Procedure get_Face2Nam */
/* Procedure get_Face1Name */
0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 2 */ NdrFcLong( 0x0 ), /* 0 */
/* 6 */ NdrFcShort( 0x7 ), /* 7 */
#ifndef _ALPHA_
/* 8 */ NdrFcShort( 0xc ), /* x86, MIPS, PPC Stack size/offset = 12 */
#else
NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */
#endif
/* 10 */ NdrFcShort( 0x0 ), /* 0 */
/* 12 */ NdrFcShort( 0x8 ), /* 8 */
/* 14 */ 0x5, /* Oi2 Flags: srv must size, has return, */
0x2, /* 2 */
/* Parameter pVal */
/* Parameter pVal */
/* Parameter pVal */
/* 16 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
#ifndef _ALPHA_
/* 18 */ NdrFcShort( 0x4 ), /* x86, MIPS, PPC Stack size/offset = 4 */
#else
NdrFcShort( 0x8 ), /* Alpha Stack size/offset = 8 */
#endif
/* 20 */ NdrFcShort( 0x1e ), /* Type Offset=30 */
/* Return value */
/* Return value */
/* Return value */
/* 22 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
#ifndef _ALPHA_
/* 24 */ NdrFcShort( 0x8 ), /* x86, MIPS, PPC Stack size/offset = 8 */
#else
NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */
#endif
/* 26 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure put_Face3Name */
/* Procedure put_Face2Nam */
/* Procedure put_Face1Name */
/* 28 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 30 */ NdrFcLong( 0x0 ), /* 0 */
/* 34 */ NdrFcShort( 0x8 ), /* 8 */
#ifndef _ALPHA_
/* 36 */ NdrFcShort( 0xc ), /* x86, MIPS, PPC Stack size/offset = 12 */
#else
NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */
#endif
/* 38 */ NdrFcShort( 0x0 ), /* 0 */
/* 40 */ NdrFcShort( 0x8 ), /* 8 */
/* 42 */ 0x6, /* Oi2 Flags: clt must size, has return, */
0x2, /* 2 */
/* Parameter newVal */
/* Parameter newVal */
/* Parameter newVal */
/* 44 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
#ifndef _ALPHA_
/* 46 */ NdrFcShort( 0x4 ), /* x86, MIPS, PPC Stack size/offset = 4 */
#else
NdrFcShort( 0x8 ), /* Alpha Stack size/offset = 8 */
#endif
/* 48 */ NdrFcShort( 0x2c ), /* Type Offset=44 */
/* Return value */
/* Return value */
/* Return value */
/* 50 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
#ifndef _ALPHA_
/* 52 */ NdrFcShort( 0x8 ), /* x86, MIPS, PPC Stack size/offset = 8 */
#else
NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */
#endif
/* 54 */ 0x8, /* FC_LONG */
0x0, /* 0 */
0x0
}
};
static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
{
0,
{
NdrFcShort( 0x0 ), /* 0 */
/* 2 */
0x11, 0x4, /* FC_RP [alloced_on_stack] */
/* 4 */ NdrFcShort( 0x1a ), /* Offset= 26 (30) */
/* 6 */
0x13, 0x0, /* FC_OP */
/* 8 */ NdrFcShort( 0xc ), /* Offset= 12 (20) */
/* 10 */
0x1b, /* FC_CARRAY */
0x1, /* 1 */
/* 12 */ NdrFcShort( 0x2 ), /* 2 */
/* 14 */ 0x9, /* Corr desc: FC_ULONG */
0x0, /* */
/* 16 */ NdrFcShort( 0xfffc ), /* -4 */
/* 18 */ 0x6, /* FC_SHORT */
0x5b, /* FC_END */
/* 20 */
0x17, /* FC_CSTRUCT */
0x3, /* 3 */
/* 22 */ NdrFcShort( 0x8 ), /* 8 */
/* 24 */ NdrFcShort( 0xfffffff2 ), /* Offset= -14 (10) */
/* 26 */ 0x8, /* FC_LONG */
0x8, /* FC_LONG */
/* 28 */ 0x5c, /* FC_PAD */
0x5b, /* FC_END */
/* 30 */ 0xb4, /* FC_USER_MARSHAL */
0x83, /* 131 */
/* 32 */ NdrFcShort( 0x0 ), /* 0 */
/* 34 */ NdrFcShort( 0x4 ), /* 4 */
/* 36 */ NdrFcShort( 0x0 ), /* 0 */
/* 38 */ NdrFcShort( 0xffffffe0 ), /* Offset= -32 (6) */
/* 40 */
0x12, 0x0, /* FC_UP */
/* 42 */ NdrFcShort( 0xffffffea ), /* Offset= -22 (20) */
/* 44 */ 0xb4, /* FC_USER_MARSHAL */
0x83, /* 131 */
/* 46 */ NdrFcShort( 0x0 ), /* 0 */
/* 48 */ NdrFcShort( 0x4 ), /* 4 */
/* 50 */ NdrFcShort( 0x0 ), /* 0 */
/* 52 */ NdrFcShort( 0xfffffff4 ), /* Offset= -12 (40) */
0x0
}
};
const CInterfaceProxyVtbl * _MultiFace_ProxyVtblList[] =
{
( CInterfaceProxyVtbl *) &_IFace1ProxyVtbl,
( CInterfaceProxyVtbl *) &_IFace2ProxyVtbl,
( CInterfaceProxyVtbl *) &_IFace3ProxyVtbl,
0
};
const CInterfaceStubVtbl * _MultiFace_StubVtblList[] =
{
( CInterfaceStubVtbl *) &_IFace1StubVtbl,
( CInterfaceStubVtbl *) &_IFace2StubVtbl,
( CInterfaceStubVtbl *) &_IFace3StubVtbl,
0
};
PCInterfaceName const _MultiFace_InterfaceNamesList[] =
{
"IFace1",
"IFace2",
"IFace3",
0
};
const IID * _MultiFace_BaseIIDList[] =
{
&IID_IDispatch,
&IID_IDispatch,
&IID_IDispatch,
0
};
#define _MultiFace_CHECK_IID(n) IID_GENERIC_CHECK_IID( _MultiFace, pIID, n)
int __stdcall _MultiFace_IID_Lookup( const IID * pIID, int * pIndex )
{
IID_BS_LOOKUP_SETUP
IID_BS_LOOKUP_INITIAL_TEST( _MultiFace, 3, 2 )
IID_BS_LOOKUP_NEXT_TEST( _MultiFace, 1 )
IID_BS_LOOKUP_RETURN_RESULT( _MultiFace, 3, *pIndex )
}
const ExtendedProxyFileInfo MultiFace_ProxyFileInfo =
{
(PCInterfaceProxyVtblList *) & _MultiFace_ProxyVtblList,
(PCInterfaceStubVtblList *) & _MultiFace_StubVtblList,
(const PCInterfaceName * ) & _MultiFace_InterfaceNamesList,
(const IID ** ) & _MultiFace_BaseIIDList,
& _MultiFace_IID_Lookup,
3,
2,
0, /* table of [async_uuid] interfaces */
0, /* Filler1 */
0, /* Filler2 */
0 /* Filler3 */
};

View File

@@ -1,11 +0,0 @@
LIBRARY "MultiFacePS"
DESCRIPTION 'Proxy/Stub DLL'
EXPORTS
DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
GetProxyDllInfo @3 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE

View File

@@ -1,16 +0,0 @@
MultiFaceps.dll: dlldata.obj MultiFace_p.obj MultiFace_i.obj
link /dll /out:MultiFaceps.dll /def:MultiFaceps.def /entry:DllMain dlldata.obj MultiFace_p.obj MultiFace_i.obj \
kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \
.c.obj:
cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \
$<
clean:
@del MultiFaceps.dll
@del MultiFaceps.lib
@del MultiFaceps.exp
@del dlldata.obj
@del MultiFace_p.obj
@del MultiFace_i.obj

View File

@@ -1,12 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#include <statreg.cpp>
#endif
#include <atlimpl.cpp>

View File

@@ -1,27 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__9BF24406_B2E0_11D4_A695_00104BFF3241__INCLUDED_)
#define AFX_STDAFX_H__9BF24406_B2E0_11D4_A695_00104BFF3241__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define _ATL_APARTMENT_THREADED
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__9BF24406_B2E0_11D4_A695_00104BFF3241__INCLUDED)

View File

@@ -1,38 +0,0 @@
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( MultiFace )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( MultiFace ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */

View File

@@ -1,18 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by MultiFace.rc
//
#define IDS_PROJNAME 100
#define IDS_FACE_DESC 101
#define IDR_Face 102
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif

View File

@@ -1,37 +0,0 @@
package com.jacob.test.atl;
import com.jacob.com.*;
import com.jacob.activeX.*;
class MultiFaceTest {
public static void main(String[] args) {
// this method has been deprecated as being unreliable.
// shutdown should be done through other means
// whoever wrote this example should explain what this was intended to do
//System.runFinalizersOnExit(true);
ActiveXComponent mf = new ActiveXComponent("MultiFace.Face");
try {
// I am now dealing with the default interface (IFace1)
Dispatch.put(mf, "Face1Name", new Variant("Hello Face1"));
System.out.println(Dispatch.get(mf, "Face1Name"));
// get to IFace2 through the IID
Dispatch f2 = mf
.QueryInterface("{9BF24410-B2E0-11D4-A695-00104BFF3241}");
// I am now dealing with IFace2
Dispatch.put(f2, "Face2Nam", new Variant("Hello Face2"));
System.out.println(Dispatch.get(f2, "Face2Nam"));
// get to IFace3 through the IID
Dispatch f3 = mf
.QueryInterface("{9BF24411-B2E0-11D4-A695-00104BFF3241}");
// I am now dealing with IFace3
Dispatch.put(f3, "Face3Name", new Variant("Hello Face3"));
System.out.println(Dispatch.get(f3, "Face3Name"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -1,14 +0,0 @@
This example demonstrates how to access multiple interfaces.
To run it, chdir to MultiFace\Debug and run:
regsvr32 MultiFace.dll
Then, run (in this dir):
java MultiFace
As you can see from MultiFace\MultiFace.idl - there are 3 interfaces.
By default JACOB attaches to the default interface.
The file MultiFace.java shows how to use the new Dispatch.QueryInterface
to get access to the other interfaces.

View File

@@ -6,6 +6,7 @@ import com.jacob.com.Dispatch;
import com.jacob.com.DispatchEvents;
import com.jacob.com.InvocationProxy;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* This test was lifted from a forum posting and shows how you can't listen to
@@ -15,13 +16,13 @@ import com.jacob.com.Variant;
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
public class ExcelEventTest extends InvocationProxy {
public class ExcelEventTest extends BaseTestCase {
/**
* load up excel, register for events and make stuff happen
* @param args
*/
public static void main(String args[]) {
public void testExcelWithInvocationProxy() {
String pid = "Excel.Application";
String typeLibLocation = "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE";
@@ -31,9 +32,9 @@ public class ExcelEventTest extends InvocationProxy {
// Add a listener (doesn't matter what it is).
DispatchEvents de;
if (typeLibLocation == null) {
de = new DispatchEvents(axc, new ExcelEventTest());
de = new DispatchEvents(axc, new ExcelEvents());
} else {
de = new DispatchEvents(axc, new ExcelEventTest(), pid,
de = new DispatchEvents(axc, new ExcelEvents(), pid,
typeLibLocation);
}
if (de == null) {
@@ -67,16 +68,18 @@ public class ExcelEventTest extends InvocationProxy {
} catch (ComException cfe) {
cfe.printStackTrace();
System.out.println("Failed to attach to " + pid + ": "
fail("Failed to attach to " + pid + ": "
+ cfe.getMessage());
}
}
public class ExcelEvents extends InvocationProxy {
/**
* Constructor so we can create an instance that implements invoke()
*/
public ExcelEventTest() {
public ExcelEvents() {
}
/**
@@ -89,3 +92,4 @@ public class ExcelEventTest extends InvocationProxy {
}
}
}

View File

@@ -1,7 +1,11 @@
package com.jacob.test.events;
import com.jacob.com.*;
import com.jacob.activeX.*;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.DispatchEvents;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* This test runs fine against jdk 1.4 and 1.5
*
@@ -15,10 +19,9 @@ import com.jacob.activeX.*;
* Look in the docs area at the Jacob usage document for command line options.
*/
class IETest
{
public static void main(String[] args)
{
public class IETest extends BaseTestCase {
public void testRunIE() {
// this line starts the pump but it runs fine without it
ComThread.startMainSTA();
// remove this line and it dies
@@ -39,6 +42,10 @@ class IETest
ComThread.quitMainSTA();
System.out.println("Main: did quit main sta in thread "
+Thread.currentThread().getName());
if (aThread.threadFailedWithException != null){
fail("caught an unexpected exception "+aThread.threadFailedWithException);
}
}
}
@@ -46,6 +53,11 @@ class IETestThread extends Thread
{
public static boolean quitHandled = false;
/**
* holds any caught exception so the main/test case can see them
*/
public Throwable threadFailedWithException = null;
public IETestThread(){
super();
}
@@ -80,8 +92,10 @@ class IETestThread extends Thread
System.out.println("IETestThread: Did call navigate to yahoo");
try { Thread.sleep(delay); } catch (Exception e) {}
} catch (Exception e) {
threadFailedWithException = e;
e.printStackTrace();
} catch (Throwable re){
threadFailedWithException = re;
re.printStackTrace();
} finally {
System.out.println("IETestThread: About to send Quit");

View File

@@ -5,6 +5,7 @@ import com.jacob.activeX.ActiveXDispatchEvents;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* This test runs fine against jdk 1.4 and 1.5
*
@@ -18,10 +19,10 @@ import com.jacob.com.Variant;
* Look in the docs area at the Jacob usage document for command line options.
*/
class IETestActiveXProxy
{
public static void main(String[] args)
{
public class IETestActiveXProxy extends BaseTestCase {
public void testIEActiveProxyCallback() {
// this line starts the pump but it runs fine without it
ComThread.startMainSTA();
// remove this line and it dies
@@ -42,6 +43,9 @@ class IETestActiveXProxy
ComThread.quitMainSTA();
System.out.println("Main: did quit main sta in thread "
+Thread.currentThread().getName());
if (aThread.threadFailedWithException != null){
fail("caught an unexpected exception "+aThread.threadFailedWithException);
}
}
}
@@ -49,6 +53,11 @@ class IETestActiveProxyThread extends Thread
{
public static boolean quitHandled = false;
/**
* holds any caught exception so the main/test case can see them
*/
public Throwable threadFailedWithException = null;
public IETestActiveProxyThread(){
super();
}
@@ -83,8 +92,10 @@ class IETestActiveProxyThread extends Thread
System.out.println("IETestActiveProxyThread: Did call navigate to yahoo");
try { Thread.sleep(delay); } catch (Exception e) {}
} catch (Exception e) {
e.printStackTrace();
threadFailedWithException = e;
e.printStackTrace();
} catch (Throwable re){
threadFailedWithException = re;
re.printStackTrace();
} finally {
System.out.println("IETestActiveProxyThread: About to send Quit");

View File

@@ -5,6 +5,7 @@ import com.jacob.com.ComException;
import com.jacob.com.DispatchEvents;
import com.jacob.com.InvocationProxy;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* This test was lifted from a forum posting and shows how you can't listen to
@@ -17,13 +18,13 @@ import com.jacob.com.Variant;
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
public class WordEventTest extends InvocationProxy {
public class WordEventTest extends BaseTestCase {
/**
* load up word, register for events and make stuff happen
* @param args
*/
public static void main(String args[]) {
public void testCaptureWordEvents() {
String pid = "Word.Application";
String typeLibLocation = null;
@@ -39,8 +40,7 @@ public class WordEventTest extends InvocationProxy {
typeLibLocation);
}
if (de == null) {
System.out
.println("No exception thrown but no dispatch returned for Word events");
fail("No exception thrown but no dispatch returned for Word events");
} else {
// Yea!
System.out.println("Successfully attached to " + pid);
@@ -52,14 +52,13 @@ public class WordEventTest extends InvocationProxy {
axc.setProperty("Visible",true);
ActiveXComponent documents = axc.getPropertyAsComponent("Documents");
if (documents == null){
System.out.println("unable to get documents");
fail("unable to get documents");
}
axc.invoke("Quit", new Variant[] {});
} catch (ComException cfe) {
cfe.printStackTrace();
System.out.println("Failed to attach to " + pid + ": "
+ cfe.getMessage());
fail("Failed to attach to " + pid + ": " + cfe.getMessage());
}
System.out.println(
@@ -68,10 +67,11 @@ public class WordEventTest extends InvocationProxy {
"thinks we tested something");
}
public class WordEvents extends InvocationProxy {
/**
* Constructor so we can create an instance that implements invoke()
*/
public WordEventTest() {
public WordEvents() {
}
/**
@@ -83,3 +83,4 @@ public class WordEventTest extends InvocationProxy {
}
}
}

View File

@@ -9,8 +9,10 @@ package com.jacob.test.powerpoint;
* Look in the docs area at the Jacob usage document for command line options.
*/
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComFailException;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.test.BaseTestCase;
/**
*
@@ -18,67 +20,31 @@ import com.jacob.com.Dispatch;
* The submitter stated they had the problem on windows 2000 with office 2000
* I have been unable to duplicate on windows XP with office 2003.
* I am comitting this to the tree just in case we need to come back to it.
* <P>
* This relies on BaseTestCase to provide the root path to the file under test
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
public class PowerpointTest extends Thread {
public class PowerpointTest extends BaseTestCase {
private static final int NUM_THREADS = 5;
protected static final int NUM_ITERATIONS = 50;
private static String POWERPOINT_TEST_PATH =
"D:\\jacob\\samples\\com\\jacob\\test\\powerpoint";
//"c:\\PowerpointTest\test";
private int threadID;
private Dispatch comPowerpoint;
public PowerpointTest(int threadID, Dispatch comPowerpoint) {
super("TestThread "+threadID);
this.threadID = threadID;
this.comPowerpoint = comPowerpoint;
}
public void run() {
System.out.println("Thread \""+Thread.currentThread().getName()+"\" started");
System.out.flush();
ComThread.InitMTA();
try {
for (int i=0; i<NUM_ITERATIONS; i++) {
if (i % 10 == 0) {
System.out.println(Thread.currentThread().getName()+": Iteration "+i);
System.out.flush();
}
Dispatch comPresentations = Dispatch.get(comPowerpoint,"Presentations").toDispatch();
Dispatch comPresentation = Dispatch.call(comPresentations,
"Open",
POWERPOINT_TEST_PATH+"\\test"+threadID+".ppt",
new Integer(0),
new Integer(0),
new Integer(0)).toDispatch();
Dispatch.call(comPresentation, "Close");
}
} catch (Exception e) {
System.err.println("Error in Thread \""+Thread.currentThread().getName()+"\":");
e.printStackTrace();
} finally {
ComThread.Release();
System.out.println("Thread \""+Thread.currentThread().getName()+"\" finished");
System.out.flush();
}
}
/**
* main program that lets us run this as a test
* @param args
*/
public static void main(String[] args) {
public void testPowerpoint() {
ComThread.InitMTA();
ActiveXComponent component = new ActiveXComponent("Powerpoint.Application");
Dispatch comPowerpoint = component.getObject();
try {
PowerpointTest[] threads = new PowerpointTest[NUM_THREADS];
try {
PowerpointTestThread[] threads = new PowerpointTestThread[NUM_THREADS];
for (int i=0; i<NUM_THREADS; i++) {
threads[i] = new PowerpointTest(i+1, comPowerpoint);
threads[i] = new PowerpointTestThread(i+1, comPowerpoint);
threads[i].start();
}
@@ -100,9 +66,68 @@ public class PowerpointTest extends Thread {
}
}
Dispatch.call(comPowerpoint,"Quit");
Dispatch.call(comPowerpoint,"Quit");
for (int i = 0 ; i < NUM_THREADS; i++){
if (threads[i].threadFailedWithException != null){
fail ("caught unexpected exception in thread "+
threads[i].threadFailedWithException);
}
}
} finally {
ComThread.Release();
}
}
public class PowerpointTestThread extends Thread {
/**
* holds any caught exception so the main/test case can see them
*/
public Throwable threadFailedWithException = null;
private int threadID;
private Dispatch comPowerpoint;
public PowerpointTestThread(int threadID, Dispatch comPowerpoint) {
super("TestThread "+threadID);
this.threadID = threadID;
this.comPowerpoint = comPowerpoint;
}
public void run() {
System.out.println("Thread \""+Thread.currentThread().getName()+"\" started");
System.out.flush();
ComThread.InitMTA();
try {
for (int i=0; i<NUM_ITERATIONS; i++) {
if (i % 10 == 0) {
System.out.println(Thread.currentThread().getName()+": Iteration "+i);
System.out.flush();
}
Dispatch comPresentations = Dispatch.get(comPowerpoint,"Presentations").toDispatch();
Dispatch comPresentation = Dispatch.call(comPresentations,
"Open",
getWindowsFilePathToPackageResource("test"+threadID+".ppt",this.getClass()),
new Integer(0),
new Integer(0),
new Integer(0)).toDispatch();
Dispatch.call(comPresentation, "Close");
}
} catch (ComFailException cfe){
threadFailedWithException = cfe;
System.err.println(Thread.currentThread().getName()+"\" while working on: "+
getWindowsFilePathToPackageResource("test"+threadID+".ppt",this.getClass()));
cfe.printStackTrace();
} catch (Exception e) {
threadFailedWithException = e;
System.err.println("Error in Thread \""+Thread.currentThread().getName()+"\":");
e.printStackTrace();
} finally {
ComThread.Release();
System.out.println("Thread \""+Thread.currentThread().getName()+"\" finished");
System.out.flush();
}
}
}
}

View File

@@ -1,16 +1,21 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* SafeArrayTest Program
*
* This is more of an exerciser. It doesn't verify that it gets back
* what it expects like a junit test would
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*
*/
class sa_test {
public static void main(String[] args) {
public class SafeArrayBasicTest extends BaseTestCase {
public void testBasicSafeArray(){
//System.runFinalizersOnExit(true);
SafeArray sa = new SafeArray(Variant.VariantVariant, 3);
@@ -60,11 +65,9 @@ class sa_test {
new Variant(1), new Variant(2.3), new Variant("hi") });
System.out.println("sa variant=" + sa);
sa_ND_test();
}
public static void sa_ND_test() {
public void testSafeArrayNumDimensions() {
int[] lowerBounds = new int[] { 0, 0, 0 };
int[] dimensionSizes = new int[] { 3, 3, 3 };

View File

@@ -1,276 +1,273 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.com.ComFailException;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
class SafeArrayContents
{
/**
* A safe array contents test (old test)
*
* <p>
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options.
*/
public class SafeArrayContents extends BaseTestCase {
public static void printArray(boolean a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(boolean a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(int a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(int a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(short a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(short a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(byte a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(byte a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(double a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(double a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(float a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(float a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(String a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(String a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(Variant a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(Variant a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(char a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(char a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void main(String[] args)
{
// int
System.out.println("Int");
SafeArray ia = new SafeArray(Variant.VariantInt,4);
System.out.println("elem size:"+ia.getElemSize());
int iack[] = new int[] {100000,200000,300000,400000};
printArray(iack);
ia.fromIntArray(iack);
iack = ia.toIntArray();
printArray(iack);
public void testSafeArrayContents() {
// int
System.out.println("Int");
SafeArray ia = new SafeArray(Variant.VariantInt, 4);
System.out.println("elem size:" + ia.getElemSize());
int iack[] = new int[] { 100000, 200000, 300000, 400000 };
printArray(iack);
ia.fromIntArray(iack);
iack = ia.toIntArray();
printArray(iack);
int i4[] = new int[4];
ia.getInts(0, 4, i4, 0);
printArray(i4);
int i4[] = new int[4];
ia.getInts(0, 4, i4, 0);
printArray(i4);
SafeArray ia2 = new SafeArray(Variant.VariantInt,4);
ia2.setInts(0, 4, i4, 0);
iack = ia2.toIntArray();
printArray(iack);
SafeArray ia2 = new SafeArray(Variant.VariantInt, 4);
ia2.setInts(0, 4, i4, 0);
iack = ia2.toIntArray();
printArray(iack);
// double
System.out.println("Double");
SafeArray da = new SafeArray(Variant.VariantDouble,4);
System.out.println("elem size:"+da.getElemSize());
double dack[] = new double[] {123.456,456.123,1234567.89,12.3456789};
printArray(dack);
da.fromDoubleArray(dack);
dack = da.toDoubleArray();
printArray(dack);
// double
System.out.println("Double");
SafeArray da = new SafeArray(Variant.VariantDouble, 4);
System.out.println("elem size:" + da.getElemSize());
double dack[] = new double[] { 123.456, 456.123, 1234567.89, 12.3456789 };
printArray(dack);
da.fromDoubleArray(dack);
dack = da.toDoubleArray();
printArray(dack);
double d4[] = new double[4];
da.getDoubles(0, 4, d4, 0);
printArray(d4);
double d4[] = new double[4];
da.getDoubles(0, 4, d4, 0);
printArray(d4);
SafeArray da2 = new SafeArray(Variant.VariantDouble,4);
da2.setDoubles(0, 4, d4, 0);
dack = da2.toDoubleArray();
printArray(dack);
SafeArray da2 = new SafeArray(Variant.VariantDouble, 4);
da2.setDoubles(0, 4, d4, 0);
dack = da2.toDoubleArray();
printArray(dack);
// float
System.out.println("Float");
SafeArray fa = new SafeArray(Variant.VariantFloat,4);
System.out.println("elem size:"+fa.getElemSize());
float fack[] = new float[] {123.456F,456.123F,1234567.89F,12.3456789F};
printArray(fack);
fa.fromFloatArray(fack);
fack = fa.toFloatArray();
printArray(fack);
// float
System.out.println("Float");
SafeArray fa = new SafeArray(Variant.VariantFloat, 4);
System.out.println("elem size:" + fa.getElemSize());
float fack[] = new float[] { 123.456F, 456.123F, 1234567.89F,
12.3456789F };
printArray(fack);
fa.fromFloatArray(fack);
fack = fa.toFloatArray();
printArray(fack);
float f4[] = new float[4];
fa.getFloats(0, 4, f4, 0);
printArray(f4);
float f4[] = new float[4];
fa.getFloats(0, 4, f4, 0);
printArray(f4);
SafeArray fa2 = new SafeArray(Variant.VariantFloat,4);
fa2.setFloats(0, 4, f4, 0);
fack = fa2.toFloatArray();
printArray(fack);
SafeArray fa2 = new SafeArray(Variant.VariantFloat, 4);
fa2.setFloats(0, 4, f4, 0);
fack = fa2.toFloatArray();
printArray(fack);
// boolean
System.out.println("Boolean");
SafeArray ba = new SafeArray(Variant.VariantBoolean,4);
System.out.println("elem size:"+ba.getElemSize());
boolean back[] = new boolean[] {true, false, true, false};
printArray(back);
ba.fromBooleanArray(back);
back = ba.toBooleanArray();
printArray(back);
// boolean
System.out.println("Boolean");
SafeArray ba = new SafeArray(Variant.VariantBoolean, 4);
System.out.println("elem size:" + ba.getElemSize());
boolean back[] = new boolean[] { true, false, true, false };
printArray(back);
ba.fromBooleanArray(back);
back = ba.toBooleanArray();
printArray(back);
boolean b4[] = new boolean[4];
ba.getBooleans(0, 4, b4, 0);
printArray(b4);
boolean b4[] = new boolean[4];
ba.getBooleans(0, 4, b4, 0);
printArray(b4);
SafeArray ba2 = new SafeArray(Variant.VariantBoolean,4);
ba2.setBooleans(0, 4, b4, 0);
back = ba2.toBooleanArray();
printArray(back);
SafeArray ba2 = new SafeArray(Variant.VariantBoolean, 4);
ba2.setBooleans(0, 4, b4, 0);
back = ba2.toBooleanArray();
printArray(back);
// char
System.out.println("Char");
SafeArray ca = new SafeArray(Variant.VariantShort,4);
System.out.println("elem size:"+ca.getElemSize());
char cack[] = new char[] {'a','b','c','d'};
printArray(cack);
ca.fromCharArray(cack);
cack = ca.toCharArray();
printArray(cack);
// char
System.out.println("Char");
SafeArray ca = new SafeArray(Variant.VariantShort, 4);
System.out.println("elem size:" + ca.getElemSize());
char cack[] = new char[] { 'a', 'b', 'c', 'd' };
printArray(cack);
ca.fromCharArray(cack);
cack = ca.toCharArray();
printArray(cack);
char c4[] = new char[4];
ca.getChars(0, 4, c4, 0);
printArray(c4);
char c4[] = new char[4];
ca.getChars(0, 4, c4, 0);
printArray(c4);
SafeArray ca2 = new SafeArray(Variant.VariantShort,4);
ca2.setChars(0, 4, c4, 0);
cack = ca2.toCharArray();
printArray(cack);
SafeArray ca2 = new SafeArray(Variant.VariantShort, 4);
ca2.setChars(0, 4, c4, 0);
cack = ca2.toCharArray();
printArray(cack);
// short
System.out.println("Short");
SafeArray sha = new SafeArray(Variant.VariantShort,4);
System.out.println("elem size:"+sha.getElemSize());
short shack[] = new short[] {1000,2000,3000,4000};
printArray(shack);
sha.fromShortArray(shack);
shack = sha.toShortArray();
printArray(shack);
// short
System.out.println("Short");
SafeArray sha = new SafeArray(Variant.VariantShort, 4);
System.out.println("elem size:" + sha.getElemSize());
short shack[] = new short[] { 1000, 2000, 3000, 4000 };
printArray(shack);
sha.fromShortArray(shack);
shack = sha.toShortArray();
printArray(shack);
short sh4[] = new short[4];
sha.getShorts(0, 4, sh4, 0);
printArray(sh4);
short sh4[] = new short[4];
sha.getShorts(0, 4, sh4, 0);
printArray(sh4);
SafeArray sha2 = new SafeArray(Variant.VariantShort,4);
sha2.setShorts(0, 4, sh4, 0);
shack = sha2.toShortArray();
printArray(shack);
SafeArray sha2 = new SafeArray(Variant.VariantShort, 4);
sha2.setShorts(0, 4, sh4, 0);
shack = sha2.toShortArray();
printArray(shack);
// string
System.out.println("String");
SafeArray sa = new SafeArray(Variant.VariantString,4);
System.out.println("elem size:"+sa.getElemSize());
String sack[] = new String[] {"aa","bb","cc","dd"};
printArray(sack);
sa.fromStringArray(sack);
sack = sa.toStringArray();
printArray(sack);
// string
System.out.println("String");
SafeArray sa = new SafeArray(Variant.VariantString, 4);
System.out.println("elem size:" + sa.getElemSize());
String sack[] = new String[] { "aa", "bb", "cc", "dd" };
printArray(sack);
sa.fromStringArray(sack);
sack = sa.toStringArray();
printArray(sack);
String s4[] = new String[4];
sa.getStrings(0, 4, s4, 0);
printArray(s4);
String s4[] = new String[4];
sa.getStrings(0, 4, s4, 0);
printArray(s4);
SafeArray sa2 = new SafeArray(Variant.VariantString,4);
sa2.setStrings(0, 4, s4, 0);
sack = sa2.toStringArray();
printArray(sack);
SafeArray sa2 = new SafeArray(Variant.VariantString, 4);
sa2.setStrings(0, 4, s4, 0);
sack = sa2.toStringArray();
printArray(sack);
// variant
System.out.println("Variant");
SafeArray va = new SafeArray(Variant.VariantVariant,4);
System.out.println("elem size:"+va.getElemSize());
Variant vack[] = new Variant[]
{
new Variant(1),
new Variant(2.3),
new Variant(true),
new Variant("four"),
};
printArray(vack);
va.fromVariantArray(vack);
vack = va.toVariantArray();
printArray(vack);
// variant
System.out.println("Variant");
SafeArray va = new SafeArray(Variant.VariantVariant, 4);
System.out.println("elem size:" + va.getElemSize());
Variant vack[] = new Variant[] { new Variant(1), new Variant(2.3),
new Variant(true), new Variant("four"), };
printArray(vack);
va.fromVariantArray(vack);
vack = va.toVariantArray();
printArray(vack);
Variant v4[] = new Variant[4];
va.getVariants(0, 4, v4, 0);
printArray(v4);
Variant v4[] = new Variant[4];
va.getVariants(0, 4, v4, 0);
printArray(v4);
SafeArray va2 = new SafeArray(Variant.VariantVariant,4);
va2.setVariants(0, 4, v4, 0);
vack = va2.toVariantArray();
printArray(vack);
SafeArray va2 = new SafeArray(Variant.VariantVariant, 4);
va2.setVariants(0, 4, v4, 0);
vack = va2.toVariantArray();
printArray(vack);
// byte
System.out.println("Byte");
SafeArray bba = new SafeArray(Variant.VariantByte,4);
System.out.println("elem size:"+bba.getElemSize());
byte bback[] = new byte[] {0x1,0x2,0x3,0x4};
printArray(bback);
bba.fromByteArray(bback);
bback = bba.toByteArray();
printArray(bback);
// byte
System.out.println("Byte");
SafeArray bba = new SafeArray(Variant.VariantByte, 4);
System.out.println("elem size:" + bba.getElemSize());
byte bback[] = new byte[] { 0x1, 0x2, 0x3, 0x4 };
printArray(bback);
bba.fromByteArray(bback);
bback = bba.toByteArray();
printArray(bback);
byte bb4[] = new byte[4];
bba.getBytes(0, 4, bb4, 0);
printArray(bb4);
byte bb4[] = new byte[4];
bba.getBytes(0, 4, bb4, 0);
printArray(bb4);
SafeArray bba2 = new SafeArray(Variant.VariantByte,4);
bba2.setBytes(0, 4, bb4, 0);
bback = bba2.toByteArray();
printArray(bback);
SafeArray bba2 = new SafeArray(Variant.VariantByte, 4);
bba2.setBytes(0, 4, bb4, 0);
bback = bba2.toByteArray();
printArray(bback);
try {
System.out.println("Should see a com exception right after this line...");
// this should throw ComException
bba2.fromCharArray(new char[] {'a'});
} catch (Exception e) {
e.printStackTrace();
}
}
try {
// this should throw ComException
bba2.fromCharArray(new char[] { 'a' });
fail("Failed to catch expected exception");
} catch (ComFailException cfe) {
// do nothing
//cfe.printStackTrace();
}
}
}

View File

@@ -0,0 +1,42 @@
package com.jacob.test.safearray;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.Dispatch;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
public class SafeArrayDispatchTest extends BaseTestCase {
public void testDispatchWithSafeArray() {
try {
String scriptCommand = "1+(2*4)-3";
String lang = "VBScript";
ActiveXComponent sControl = new ActiveXComponent("ScriptControl");
Dispatch.put(sControl, "Language", lang);
Variant result = Dispatch.call(sControl, "Eval", scriptCommand);
assertTrue(result.toString().equals("6"));
// wrap the script control in a variant
Variant v = new Variant(sControl);
// create a safe array of type dispatch
SafeArray sa = new SafeArray(Variant.VariantDispatch, 1);
// put the variant in the array
sa.setVariant(0, v);
// take it back out
Variant v2 = sa.getVariant(0);
Dispatch d = v2.toDispatch();
// make sure you can call eval on it
result = Dispatch.call(d, "Eval", scriptCommand);
assertTrue(result.toString().equals("6"));
} catch (ComException e) {
e.printStackTrace();
fail("script failure "+e);
}
}
}

View File

@@ -3,6 +3,7 @@ package com.jacob.test.safearray;
import com.jacob.com.ComThread;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* <p>
@@ -73,13 +74,15 @@ import com.jacob.com.Variant;
+-----------+ | VT_ARRAY| +---------+
| parray---->SAFEARRAY|
+------------+ +---------+
*
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
public class SafeArrayReleaseTest
{
public class SafeArrayReleaseTest extends BaseTestCase {
final static int MAX = 300;
public static void main(String[] args)
{
public void testSaveArrayRelease() {
int count;
System.out.println("Starting test for max = "+MAX);
for(count = 1; count<MAX; count++)
@@ -105,9 +108,7 @@ public class SafeArrayReleaseTest
}
catch (Exception e)
{
System.out.println("\nTest fails with i = " + i + " (max = "+MAX+")");
e.printStackTrace();
break;
fail("Test fails with i = " + i + " (max = "+MAX+")");
}
}
System.gc();

View File

@@ -1,60 +1,69 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.test.BaseTestCase;
import com.jacob.activeX.*;
public class SafeArrayViaExcel
{
public static void main(java.lang.String[] args)
{
//deprecated
//System.runFinalizersOnExit(true);
/**
* This does simple tests with SafeArray using Excel as a source
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
* <p>
* This relies on BaseTestCase to provide the root path to the file under test
*/
public class SafeArrayViaExcel extends BaseTestCase {
public void testSafeArrayViaExcel() {
// deprecated
// System.runFinalizersOnExit(true);
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
try {
Dispatch cell;
SafeArray sAProdText;
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
System.out.println("have workbooks");
Dispatch workbook = Dispatch.call(workbooks, "Open", "d:\\jacob\\samples\\test\\ExcelSafeArray" +
".xls").toDispatch();
System.out.println("Opened File - jacobtest.xls\n");
Dispatch sheet = Dispatch.get(workbook,"ActiveSheet").toDispatch();
cell = Dispatch.invoke(sheet,"Range",Dispatch.Get,new Object[] {"A1:D1000"},new int[1]).toDispatch();
System.out.println("have cell:"+cell);
sAProdText = Dispatch.get(cell,"Value").toSafeArray();
System.out.println("sa: dim="+sAProdText.getNumDim());
System.out.println("sa: start row="+sAProdText.getLBound(1));
System.out.println("sa: start col="+sAProdText.getLBound(2));
System.out.println("sa: end row="+sAProdText.getUBound(1));
System.out.println("sa: end col="+sAProdText.getUBound(2));
int i;
int lineNumber=1;
int n = 0;
for(lineNumber=1; lineNumber < 1000; lineNumber++)
{
for (i = 1 ; i < 4 ; i++ ) {
System.out.println((n++) + " " + lineNumber+" "+i+" " +sAProdText.getString(lineNumber,i));
/*
if (sAProdText.getString(lineNumber,i).compareTo("aaaa") != 0 ) {
System.out.println("Invalid String in line " + lineNumber + " Cell " + i + " Value = " + sAProdText.getString(lineNumber,i));
stringFound = false;
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
try {
Dispatch cell;
SafeArray sAProdText;
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
System.out.println("have workbooks");
Dispatch workbook = Dispatch.call(
workbooks,
"Open",
getWindowsFilePathToPackageResource("SafeArrayViaExcel.xls",this.getClass()))
.toDispatch();
System.out.println("Opened File - SafeArrayViaExcel.xls\n");
Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch();
cell = Dispatch.invoke(sheet, "Range", Dispatch.Get,
new Object[] { "A1:D1000" }, new int[1]).toDispatch();
System.out.println("have cell:" + cell);
sAProdText = Dispatch.get(cell, "Value").toSafeArray();
System.out.println("sa: dim=" + sAProdText.getNumDim());
System.out.println("sa: start row=" + sAProdText.getLBound(1));
System.out.println("sa: start col=" + sAProdText.getLBound(2));
System.out.println("sa: end row=" + sAProdText.getUBound(1));
System.out.println("sa: end col=" + sAProdText.getUBound(2));
int i;
int lineNumber = 1;
int n = 0;
for (lineNumber = 1; lineNumber < 1000; lineNumber++) {
for (i = 1; i < 4; i++) {
System.out.println((n++) + " " + lineNumber + " " + i + " "
+ sAProdText.getString(lineNumber, i));
/*
* if (sAProdText.getString(lineNumber,i).compareTo("aaaa") !=
* 0 ) { System.out.println("Invalid String in line " +
* lineNumber + " Cell " + i + " Value = " +
* sAProdText.getString(lineNumber,i)); stringFound = false; } }
* if (stringFound) { System.out.println("Valid Strings in
* line " + lineNumber); lineNumber++; }
*/
}
}
if (stringFound) {
System.out.println("Valid Strings in line " + lineNumber);
lineNumber++;
}
*/
}
Dispatch.call(workbook, "Close");
System.out.println("Closed File\n");
} catch (Exception e) {
e.printStackTrace();
fail("Caught Exception "+e);
} finally {
xl.invoke("Quit", new Variant[] {});
}
Dispatch.call(workbook, "Close");
System.out.println("Closed File\n");
} catch (Exception e) {
e.printStackTrace();
} finally {
xl.invoke("Quit", new Variant[] {});
}
}
}

View File

@@ -1,42 +0,0 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.activeX.*;
class sa_dispatch
{
public static void main(String args[])
{
// deprecated
//System.runFinalizersOnExit(true);
try {
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
Dispatch sControl = (Dispatch)sC.getObject();
Dispatch.put(sControl, "Language", lang);
Variant result = Dispatch.call(sControl, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
// wrap the script control in a variant
Variant v = new Variant(sControl);
// create a safe array of type dispatch
SafeArray sa = new SafeArray(Variant.VariantDispatch, 1);
// put the variant in the array
sa.setVariant(0, v);
// take it back out
Variant v2 = sa.getVariant(0);
Dispatch d = v2.toDispatch();
// make sure you can call eval on it
result = Dispatch.call(d, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
} catch (ComException e) {
e.printStackTrace();
}
}
}

View File

@@ -1,2 +0,0 @@
java ScriptTest "1+2"
java ScriptTest "()1+2"

View File

@@ -1,50 +1,63 @@
package com.jacob.test.vbscript;
import com.jacob.com.*;
import com.jacob.test.BaseTestCase;
import com.jacob.activeX.*;
/**
* In this case the component is created and used in the same thread
* and it's an Apartment Threaded component, so we call InitSTA.
* In this case the component is created and used in the same thread and it's an
* Apartment Threaded component, so we call InitSTA.
* <p>
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options.
*/
class ScriptTest
{
public static void main(String args[]) throws Exception
{
ComThread.InitSTA(true);
DispatchEvents de = null;
Dispatch sControl = null;
public class ScriptTest extends BaseTestCase {
try {
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
sControl = (Dispatch)sC.getObject();
Dispatch.put(sControl, "Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sControl, te);
if (de == null){
System.out.println("Received null when trying to create new DispatchEvents");
}
Variant result = Dispatch.call(sControl, "Eval", args[0]);
// call it twice to see the objects reused
result = Dispatch.call(sControl, "Eval", args[0]);
// call it 3 times to see the objects reused
result = Dispatch.call(sControl, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
} catch (ComException e) {
e.printStackTrace();
}
finally
{
Integer I = null;
for(int i=1;i<1000000;i++)
{
I = new Integer(i);
}
System.out.println(I);
public void testStupidSpeedTest() {
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
Dispatch sControl = sC.getObject();
Dispatch.put(sControl, "Language", lang);
for (int i = 0; i < 10000; i++) {
Dispatch.call(sControl, "Eval", "1+1");
}
}
public void testCreatingDispatchEvents() {
ComThread.InitSTA(true);
DispatchEvents de = null;
Dispatch sControl = null;
try {
String scriptCommand = getSampleVPScriptForEval();
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
sControl = (Dispatch) sC.getObject();
Dispatch.put(sControl, "Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sControl, te);
if (de == null) {
System.out
.println("Received null when trying to create new DispatchEvents");
}
Variant result = Dispatch.call(sControl, "Eval", scriptCommand);
// call it twice to see the objects reused
result = Dispatch.call(sControl, "Eval", scriptCommand);
// call it 3 times to see the objects reused
result = Dispatch.call(sControl, "Eval", scriptCommand);
System.out.println("eval(" + scriptCommand + ") = " + result);
} catch (ComException e) {
e.printStackTrace();
fail("Caught Exception " + e);
} finally {
Integer I = null;
for (int i = 1; i < 1000000; i++) {
I = new Integer(i);
}
System.out.println(I);
ComThread.Release();
ComThread.quitMainSTA();
}
}
}
}
}

View File

@@ -1,98 +1,98 @@
package com.jacob.test.vbscript;
import com.jacob.com.*;
import com.jacob.test.BaseTestCase;
import com.jacob.activeX.*;
/**
* This example demonstrates how to make calls between
* two different STA's.
* First, to create an STA, you need to extend the STA class
* and override its OnInit() method. This method will be called
* in the STA's thread so you can use it to create your COM
* components that will run in that STA.
* If you then try to call methods on those components from other
* threads (STA or MTA) - this will fail.
* You cannot create a component in an STA and call its methods
* from another thread.
* You can use the DispatchProxy to get a proxy to any Dispatch
* that lives in another STA. This object has to be created in the
* STA that houses the Dispatch (in this case it's created in the
* OnInit method). Then, another thread can call the toDispatch()
* method of DispatchProxy to get a local proxy. At most ONE (!)
* thread can call toDispatch(), and the call can be made only once.
* This is because a IStream object is used to pass the proxy, and
* it is only written once and closed when you read it.
* If you need multiple threads to access a Dispatch pointer, then
* create that many DispatchProxy objects.
* This example demonstrates how to make calls between two different STA's.
* First, to create an STA, you need to extend the STA class and override its
* OnInit() method. This method will be called in the STA's thread so you can
* use it to create your COM components that will run in that STA. If you then
* try to call methods on those components from other threads (STA or MTA) -
* this will fail. You cannot create a component in an STA and call its methods
* from another thread. You can use the DispatchProxy to get a proxy to any
* Dispatch that lives in another STA. This object has to be created in the STA
* that houses the Dispatch (in this case it's created in the OnInit method).
* Then, another thread can call the toDispatch() method of DispatchProxy to get
* a local proxy. At most ONE (!) thread can call toDispatch(), and the call can
* be made only once. This is because a IStream object is used to pass the
* proxy, and it is only written once and closed when you read it. If you need
* multiple threads to access a Dispatch pointer, then create that many
* DispatchProxy objects.
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
class ScriptTest2 extends STA
{
public static ActiveXComponent sC;
public static DispatchEvents de = null;
public static Dispatch sControl = null;
public static DispatchProxy sCon = null;
public boolean OnInit()
{
try
{
System.out.println("OnInit");
System.out.println(Thread.currentThread());
String lang = "VBScript";
sC = new ActiveXComponent("ScriptControl");
sControl = (Dispatch)sC.getObject();
public class ScriptTest2 extends BaseTestCase {
public void testScript2() {
try {
ComThread.InitSTA();
ScriptTestSTA script = new ScriptTestSTA();
try {
Thread.sleep(1000);
} catch (InterruptedException ie){
// should we get this?
}
// sCon can be called from another thread
sCon = new DispatchProxy(sControl);
String scriptCommand = getSampleVPScriptForEval();
// get a thread-local Dispatch from sCon
Dispatch sc = script.sCon.toDispatch();
Dispatch.put(sControl, "Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sControl, te);
return true;
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
}
// call a method on the thread-local Dispatch obtained
// from the DispatchProxy. If you try to make the same
// method call on the sControl object - you will get a
// ComException.
Variant result = Dispatch.call(sc, "Eval", scriptCommand);
System.out.println("eval(" + scriptCommand + ") = " + result);
script.quit();
System.out.println("called quit");
} catch (ComException e) {
e.printStackTrace();
fail("caught exception"+e);
} finally {
Integer I = null;
for (int i = 1; i < 1000000; i++) {
I = new Integer(i);
}
System.out.println(I);
ComThread.Release();
}
}
public void OnQuit()
{
System.out.println("OnQuit");
}
public class ScriptTestSTA extends STA {
public static void main(String args[]) throws Exception
{
try {
ComThread.InitSTA();
ScriptTest2 script = new ScriptTest2();
Thread.sleep(1000);
public DispatchEvents de = null;
// get a thread-local Dispatch from sCon
Dispatch sc = sCon.toDispatch();
public Dispatch sControl = null;
public DispatchProxy sCon = null;
public boolean OnInit() {
try {
System.out.println("OnInit");
System.out.println(Thread.currentThread());
String lang = "VBScript";
sControl = new ActiveXComponent("ScriptControl");
// sCon can be called from another thread
sCon = new DispatchProxy(sControl);
Dispatch.put(sControl, "Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sControl, te);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public void OnQuit() {
System.out.println("OnQuit");
}
}
// call a method on the thread-local Dispatch obtained
// from the DispatchProxy. If you try to make the same
// method call on the sControl object - you will get a
// ComException.
Variant result = Dispatch.call(sc, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
script.quit();
System.out.println("called quit");
} catch (ComException e) {
e.printStackTrace();
}
finally
{
Integer I = null;
for(int i=1;i<1000000;i++)
{
I = new Integer(i);
}
System.out.println(I);
ComThread.Release();
}
}
}

View File

@@ -1,96 +1,102 @@
package com.jacob.test.vbscript;
import com.jacob.com.*;
import com.jacob.activeX.*;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.ComThread;
import com.jacob.com.DispatchEvents;
import com.jacob.com.DispatchProxy;
import com.jacob.com.STA;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* This example demonstrates how to make calls between
* two different STA's.
* First, to create an STA, you need to extend the STA class
* and override its OnInit() method. This method will be called
* in the STA's thread so you can use it to create your COM
* components that will run in that STA.
* If you then try to call methods on those components from other
* threads (STA or MTA) - this will fail.
* You cannot create a component in an STA and call its methods
* from another thread.
* You can use the DispatchProxy to get a proxy to any Dispatch
* that lives in another STA. This object has to be created in the
* STA that houses the Dispatch (in this case it's created in the
* OnInit method). Then, another thread can call the toDispatch()
* method of DispatchProxy to get a local proxy. At most ONE (!)
* thread can call toDispatch(), and the call can be made only once.
* This is because a IStream object is used to pass the proxy, and
* it is only written once and closed when you read it.
* If you need multiple threads to access a Dispatch pointer, then
* create that many DispatchProxy objects.
* This example demonstrates how to make calls between two different STA's.
* First, to create an STA, you need to extend the STA class and override its
* OnInit() method. This method will be called in the STA's thread so you can
* use it to create your COM components that will run in that STA. If you then
* try to call methods on those components from other threads (STA or MTA) -
* this will fail. You cannot create a component in an STA and call its methods
* from another thread. You can use the DispatchProxy to get a proxy to any
* Dispatch that lives in another STA. This object has to be created in the STA
* that houses the Dispatch (in this case it's created in the OnInit method).
* Then, another thread can call the toDispatch() method of DispatchProxy to get
* a local proxy. At most ONE (!) thread can call toDispatch(), and the call can
* be made only once. This is because a IStream object is used to pass the
* proxy, and it is only written once and closed when you read it. If you need
* multiple threads to access a Dispatch pointer, then create that many
* DispatchProxy objects.
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
class ScriptTest2ActiveX extends STA
{
public static ActiveXComponent sC;
public static DispatchEvents de = null;
public static DispatchProxy sCon = null;
public class ScriptTest2ActiveX extends BaseTestCase {
public static ActiveXComponent sC;
public boolean OnInit()
{
try
{
System.out.println("OnInit");
System.out.println(Thread.currentThread());
String lang = "VBScript";
sC = new ActiveXComponent("ScriptControl");
public static DispatchEvents de = null;
// sCon can be called from another thread
sCon = new DispatchProxy(sC);
public static DispatchProxy sCon = null;
sC.setProperty("Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sC, te);
return true;
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
}
public void testActiveXSTA() {
try {
ComThread.InitSTA();
ScriptTest2ActiveXSTA script = new ScriptTest2ActiveXSTA();
try {
Thread.sleep(1000);
} catch (InterruptedException ie){
// should we get this?
}
public void OnQuit()
{
System.out.println("OnQuit");
}
// get a thread-local Dispatch from sCon
ActiveXComponent sc = new ActiveXComponent(sCon.toDispatch());
public static void main(String args[]) throws Exception
{
try {
ComThread.InitSTA();
ScriptTest2ActiveX script = new ScriptTest2ActiveX();
Thread.sleep(1000);
// call a method on the thread-local Dispatch obtained
// from the DispatchProxy. If you try to make the same
// method call on the sControl object - you will get a
// ComException.
String scriptCommand = getSampleVPScriptForEval();
Variant result = sc.invoke("Eval", scriptCommand);
System.out.println("eval(" + scriptCommand + ") = " + result);
script.quit();
System.out.println("called quit");
} catch (ComException e) {
e.printStackTrace();
fail("blew up with Com Exception "+e);
} finally {
Integer I = null;
for (int i = 1; i < 1000000; i++) {
I = new Integer(i);
}
System.out.println(I);
ComThread.Release();
}
}
// get a thread-local Dispatch from sCon
ActiveXComponent sc = new ActiveXComponent(sCon.toDispatch());
public class ScriptTest2ActiveXSTA extends STA {
// call a method on the thread-local Dispatch obtained
// from the DispatchProxy. If you try to make the same
// method call on the sControl object - you will get a
// ComException.
Variant result = sc.invoke("Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
script.quit();
System.out.println("called quit");
} catch (ComException e) {
e.printStackTrace();
}
finally
{
Integer I = null;
for(int i=1;i<1000000;i++)
{
I = new Integer(i);
}
System.out.println(I);
ComThread.Release();
}
}
}
public boolean OnInit() {
try {
System.out.println("OnInit");
System.out.println(Thread.currentThread());
String lang = "VBScript";
sC = new ActiveXComponent("ScriptControl");
// sCon can be called from another thread
sCon = new DispatchProxy(sC);
sC.setProperty("Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sC, te);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public void OnQuit() {
System.out.println("OnQuit");
}
}
}

View File

@@ -1,68 +1,73 @@
package com.jacob.test.vbscript;
import com.jacob.com.*;
import com.jacob.test.BaseTestCase;
import com.jacob.activeX.*;
/**
* Here we create the ScriptControl component in a separate MTA thread
* and then call the Eval method from the main thread. The main thread
* must also be an MTA thread. If you try to create it as an STA
* then you will not be able to make calls into a component running
* in another thread.
* Here we create the ScriptControl component in a separate MTA thread and then
* call the Eval method from the main thread. The main thread must also be an
* MTA thread. If you try to create it as an STA then you will not be able to
* make calls into a component running in another thread.
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
class ScriptTest3 extends Thread
{
public static ActiveXComponent sC;
public static DispatchEvents de = null;
public static Dispatch sControl = null;
public static boolean quit = false;
public class ScriptTest3 extends BaseTestCase {
public void run()
{
try
{
ComThread.InitMTA();
System.out.println("OnInit");
String lang = "VBScript";
sC = new ActiveXComponent("ScriptControl");
sControl = (Dispatch)sC.getObject();
Dispatch.put(sControl, "Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sControl, te);
System.out.println("sControl="+sControl);
while (!quit) sleep(100);
ComThread.Release();
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
System.out.println("worker thread exits");
}
}
public static ActiveXComponent sC;
public static void main(String args[]) throws Exception
{
try {
ComThread.InitMTA();
ScriptTest3 script = new ScriptTest3();
script.start();
Thread.sleep(1000);
public static DispatchEvents de = null;
Variant result = Dispatch.call(sControl, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
System.out.println("setting quit");
ScriptTest3.quit = true;
} catch (ComException e) {
e.printStackTrace();
}
finally
{
System.out.println("main done");
ComThread.Release();
}
}
public static Dispatch sControl = null;
public static boolean quit = false;
public void testScript() {
try {
ComThread.InitMTA();
ScriptTest3Inner script = new ScriptTest3Inner();
script.start();
try {
Thread.sleep(1000);
} catch (InterruptedException ie){
// should we get this?
}
Variant result = Dispatch.call(sControl, "Eval", getSampleVPScriptForEval());
System.out.println("eval(" + getSampleVPScriptForEval() + ") = " + result);
System.out.println("setting quit");
ScriptTest3.quit = true;
} catch (ComException e) {
e.printStackTrace();
fail("Caught excpetion running script with MTA");
} finally {
System.out.println("main done");
ComThread.Release();
}
}
class ScriptTest3Inner extends Thread {
public void run() {
try {
ComThread.InitMTA();
System.out.println("OnInit");
String lang = "VBScript";
sC = new ActiveXComponent("ScriptControl");
sControl = (Dispatch) sC.getObject();
Dispatch.put(sControl, "Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sControl, te);
System.out.println("sControl=" + sControl);
while (!quit)
sleep(100);
ComThread.Release();
} catch (Exception e) {
e.printStackTrace();
} finally {
System.out.println("worker thread exits");
}
}
}
}

View File

@@ -1,66 +1,72 @@
package com.jacob.test.vbscript;
import com.jacob.com.*;
import com.jacob.test.BaseTestCase;
import com.jacob.activeX.*;
/**
* Here we create the ScriptControl component in a separate MTA thread
* and then call the Eval method from the main thread. The main thread
* must also be an MTA thread. If you try to create it as an STA
* then you will not be able to make calls into a component running
* in another thread.
* Here we create the ScriptControl component in a separate MTA thread and then
* call the Eval method from the main thread. The main thread must also be an
* MTA thread. If you try to create it as an STA then you will not be able to
* make calls into a component running in another thread.
* <p>
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options.
*/
class ScriptTest3ActiveX extends Thread
{
public static ActiveXComponent sC;
public static DispatchEvents de = null;
public static boolean quit = false;
public class ScriptTest3ActiveX extends BaseTestCase {
public static ActiveXComponent sC;
public void run()
{
try
{
ComThread.InitMTA();
System.out.println("OnInit");
String lang = "VBScript";
sC = new ActiveXComponent("ScriptControl");
sC.setProperty("Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sC, te);
System.out.println("sControl="+sC);
while (!quit) sleep(100);
ComThread.Release();
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
System.out.println("worker thread exits");
}
}
public static DispatchEvents de = null;
public static void main(String args[]) throws Exception
{
try {
ComThread.InitMTA();
ScriptTest3ActiveX script = new ScriptTest3ActiveX();
script.start();
Thread.sleep(1000);
public static boolean quit = false;
Variant result = sC.invoke("Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
System.out.println("setting quit");
ScriptTest3ActiveX.quit = true;
} catch (ComException e) {
e.printStackTrace();
}
finally
{
System.out.println("main done");
ComThread.Release();
}
}
public void testYetAnotherScriptTest() {
try {
ComThread.InitMTA();
ScriptTest3ActiveXInner script = new ScriptTest3ActiveXInner();
script.start();
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
// should we get this?
}
Variant result = sC.invoke("Eval", getSampleVPScriptForEval());
System.out
.println("eval(" + getSampleVPScriptForEval()
+ ") = " + result);
System.out.println("setting quit");
ScriptTest3ActiveX.quit = true;
} catch (ComException e) {
e.printStackTrace();
fail("Caught ComException " + e);
} finally {
System.out.println("main done");
ComThread.Release();
}
}
public class ScriptTest3ActiveXInner extends Thread {
public void run() {
try {
ComThread.InitMTA();
System.out.println("OnInit");
String lang = "VBScript";
sC = new ActiveXComponent("ScriptControl");
sC.setProperty("Language", lang);
ScriptTestErrEvents te = new ScriptTestErrEvents();
de = new DispatchEvents(sC, te);
System.out.println("sControl=" + sC);
while (!quit)
sleep(100);
ComThread.Release();
} catch (Exception e) {
e.printStackTrace();
} finally {
System.out.println("worker thread exits");
}
}
}
}

View File

@@ -1,16 +1,19 @@
package com.jacob.test.vbscript;
import com.jacob.com.*;
import com.jacob.test.BaseTestCase;
import com.jacob.activeX.*;
/**
* In this case the component is created and used in the same thread
* and it's an Apartment Threaded component, so we call InitSTA.
* <p>
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options.
*/
class ScriptTestActiveX
{
public static void main(String args[]) throws Exception
{
public class ScriptTestActiveX extends BaseTestCase {
public void testActiveXScript() {
ComThread.InitSTA(true);
DispatchEvents de = null;
@@ -24,12 +27,12 @@ class ScriptTestActiveX
System.out.println("null returned when trying to create DispatchEvents");
}
Variant result;
result = sC.invoke("Eval",args[0]);
result = sC.invoke("Eval",getSampleVPScriptForEval());
// call it twice to see the objects reused
result = sC.invoke("Eval",args[0]);
result = sC.invoke("Eval",getSampleVPScriptForEval());
// call it 3 times to see the objects reused
result = sC.invoke("Eval",args[0]);
System.out.println("eval("+args[0]+") = "+ result);
result = sC.invoke("Eval",getSampleVPScriptForEval());
System.out.println("eval("+getSampleVPScriptForEval()+") = "+ result);
} catch (ComException e) {
e.printStackTrace();
}

View File

@@ -1,12 +1,13 @@
package com.jacob.test.vbscript;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* Extracted from ScriptTest so everyone can see this
* Made a test solely because it made the ant test easier
*/
public class ScriptTestErrEvents {
public class ScriptTestErrEvents extends BaseTestCase {
public void Error(Variant[] args)
{

View File

@@ -1,18 +0,0 @@
package com.jacob.test.vbscript;
import com.jacob.com.*;
import com.jacob.activeX.*;
class speed
{
public static void main(String args[])
{
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
Dispatch sControl = sC.getObject();
Dispatch.put(sControl, "Language", lang);
for(int i=0;i<10000;i++) {
Dispatch.call(sControl, "Eval", "1+1");
}
}
}

View File

@@ -9,20 +9,22 @@ package com.jacob.test.windowsmedia;
* Look in the docs area at the Jacob usage document for command line options.
*/
import com.jacob.activeX.*;
import com.jacob.test.BaseTestCase;
public class WMPlayer {
public class WMPlayer extends BaseTestCase {
public static void main(String[] args){
public void testOpenWMPlayer() {
ActiveXComponent wmp = null;
wmp = new ActiveXComponent("WMPlayer.OCX");
// the sourceforge posting didn't post all the code so this is all we have
// we need some other information on how to set the document
// the sourceforge posting didn't post all the code so this is all we
// have we need some other information on how to set the document
// so that we have a url to open
for ( int i= 0 ; i < 1000 ; i++){
System.out.println("the wmp url is "+ wmp.getProperty("URL").toString());
for (int i = 0; i < 1000; i++) {
System.out.println("the wmp url is "
+ wmp.getProperty("URL").toString());
}
}
}
}