Moved samples

This commit is contained in:
2014-11-23 22:33:56 +00:00
parent b0cfd2584f
commit 1dfb020787
69 changed files with 711 additions and 913 deletions

View File

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

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,83 @@
package com.jacob.samples.MathProj;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.DispatchEvents;
import com.jacob.com.Variant;
/**
* 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 {
/**
* standard main program to run the sample
*
* @param args
* command line parameters
*/
public static void main(String[] args) {
MathTest me = new MathTest();
me.runTest();
}
/** default constructor */
public MathTest() {
}
/**
* not clear why we need a class and run method but that's the way it was
* written
*/
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());
}
/**
*
* sample class to catch the events
*
*/
public class TestEvents {
/**
* catches the DoneAdd event
*
* @param args
*/
public void DoneAdd(Variant[] args) {
System.out.println("DoneAdd called in java");
}
/**
* catches the DoneMult event
*
* @param args
*/
public void DoneMult(Variant[] args) {
System.out.println("DoneMult called in java");
}
}
}

Binary file not shown.

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,144 @@
/*
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
* All rights reserved. Originator: Dan Adler (http://danadler.com).
* Get more information about JACOB at http://sourceforge.net/projects/jacob-project
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.jacob.samples.access;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
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.
*
*/
class Access {
/**
* the main loop for the test
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
ComThread.InitSTA();
// original test used this
// ActiveXComponent ax = new ActiveXComponent("DAO.PrivateDBEngine");
// my xp box with a later release of access needed this
ActiveXComponent ax = new ActiveXComponent("DAO.PrivateDBEngine.35");
// this only works for access files pre-access-2000
// this line doesn't work on my xp box in Eclipse
// Dispatch db = open(ax, ".\\sample2.mdb");
// this works when running in eclipse because the test cases run pwd
// project root
Dispatch db = open(ax, "samples/com/jacob/samples/access/sample2.mdb");
String sql = "select * from MainTable";
// make a temporary querydef
Dispatch qd = Dispatch.call(db, "CreateQueryDef", "").toDispatch();
// set the SQL string on it
Dispatch.put(qd, "SQL", sql);
Variant result = getByQueryDef(qd);
// the 2-d safearray is transposed from what you might expect
System.out.println("resulting array is " + result.toSafeArray());
close(db);
System.out.println("about to call ComThread.Release()");
ComThread.Release();
}
/**
* Open a database
*
* @param ax
* @param fileName
* @return dispatch object that was opened
*/
public static Dispatch open(ActiveXComponent ax, String fileName) {
Variant f = new Variant(false);
// open the file in read-only mode
Variant[] args = new Variant[] { new Variant(fileName), f, f };
Dispatch openDB = ax.invoke("OpenDatabase", args).toDispatch();
return openDB;
}
/**
* Close a database
*
* @param openDB
* db to be closed
*/
public static void close(Dispatch openDB) {
Dispatch.call(openDB, "Close");
}
/**
* Extract the values from the recordset
*
* @param recset
* @return Variant that is the returned values
*/
public static Variant getValues(Dispatch recset) {
Dispatch.callSub(recset, "moveFirst");
Variant vi = new Variant(4096);
Variant v = Dispatch.call(recset, "GetRows", vi);
return v;
}
/**
* should return ?? for the passed in ??
*
* @param qd
* @return Variant results of query?
*/
public static Variant getByQueryDef(Dispatch qd) {
// get a reference to the recordset
Dispatch recset = Dispatch.call(qd, "OpenRecordset").toDispatch();
// get the values as a safe array
String[] cols = getColumns(recset);
for (int i = 0; i < cols.length; i++) {
System.out.print(cols[i] + " ");
}
System.out.println("");
Variant vals = getValues(recset);
return vals;
}
/**
* gets the columns form the rec set
*
* @param recset
* @return list of column names
*/
public static String[] getColumns(Dispatch recset) {
Dispatch flds = Dispatch.get(recset, "Fields").toDispatch();
int n_flds = Dispatch.get(flds, "Count").getInt();
String[] s = new String[n_flds];
Variant vi = new Variant();
for (int i = 0; i < n_flds; i++) {
vi.putInt(i);
// must use the invoke method because this is a method call
// that wants to have a Dispatch.Get flag...
Dispatch fld = Dispatch.invoke(recset, "Fields", Dispatch.Get,
new Object[] { vi }, new int[1]).toDispatch();
Variant name = Dispatch.get(fld, "Name");
s[i] = name.toString();
}
return s;
}
}

Binary file not shown.

View File

@@ -0,0 +1,88 @@
- ADO Wrapper for JACOB - Copyright 1999, Dan Adler
This sample shows how to generate more strongly typed wrapper classes
for the JACOB automation classes. These are pure java classes which
extend com.jacob.com.Dispatch and delegate all the methods to the
unedrlying IDispatch pointer. This methodology is similar to the way
MFC does automation wrappers, rather than using the @com directives
to invisibly delegate the calls, as the Microsoft VM does.
The ADO wrappers in this directory are not a part of the JACOB
distribution, however, they demonstrate the preferred way to create
wrappers around the core functionality. The wrappers included here are
not a complete set, but they could easily be extended to provide all
the functionality of the com.ms.wfc.data classes.
The code in test.java demonstrates two ways to get a Recordset
from SQL Server. In this case, I query for the authors in the 'pubs'
database once by opening a Recordset object directly, and once by
using the Command and Connection objects. The same code, using the WFC
wrappers can be found in ms\testms.java in case you want to compare
the performace. You can run the test.java demo in the MS VM as well.
The constructor of the wrapper is used to create an instance.
For example, the user can write:
Connection c = new Connection();
The code for the Connection constructor is shown here:
public Connection()
{
super("ADODB.Connection");
}
it simply delegates to the com.jacob.com.Dispatch constructor which
takes a ProgID.
Since I don't have a tool like JACTIVEX yet to create the wrappers
automatically from the type library, I created them by hand by using
the JACTIVEX'ed version as a starting point, and replacing the @com
calls with delegated calls to JACOB classes. A simple PERL program
could probably be used to automate this step.
In order to return strongly typed wrappers from method calls, I had to
create a special constructor which constructs the wrapper class instance
and copies over the IDispatch pointer. This is because I can't cast a
java Dispatch object to a super class object.
For example, the Command class has a method like this:
public Connection getActiveConnection();
Ideally, I would like the wrapper code to say:
public Connection getActiveConnection()
{
// this doesn't work
return (Connection)Dispatch.get(this, "ActiveConnection").toDispatch());
}
Thereby wrapping the returned Dispatch pointer in a Connection object.
But, since I can't cast in this way, I use the following construct:
public Connection getActiveConnection()
{
// this works
return new Connection(Dispatch.get(this, "ActiveConnection").toDispatch());
}
Which uses a special constructor inserted into the Connection class:
/**
* This constructor is used instead of a case operation to
* turn a Dispatch object into a wider object - it must exist
* in every wrapper class whose instances may be returned from
* method calls wrapped in VT_DISPATCH Variants.
*/
public Connection(Dispatch d)
{
// take over the IDispatch pointer
m_pDispatch = d.m_pDispatch;
// null out the input's pointer
d.m_pDispatch = 0;
}
I have to add this constructor to any class whose instances I want
to return from wrapped calls.

View File

@@ -0,0 +1,207 @@
package com.jacob.samples.ado;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
* Custom dispatch object to make it easy for us to provide application specific
* API.
*
*/
public class Command extends Dispatch {
/**
* standard constructor
*/
public Command() {
super("ADODB.Command");
}
/**
* This constructor is used instead of a case operation to turn a Dispatch
* object into a wider object - it must exist in every wrapper class whose
* instances may be returned from method calls wrapped in VT_DISPATCH
* Variants.
*
* @param dispatchTarget
*/
public Command(Dispatch dispatchTarget) {
super(dispatchTarget);
}
/**
* runs the "Properties" command
*
* @return the properties
*/
public Variant getProperties() {
return Dispatch.get(this, "Properties");
}
/**
* runs the "ActiveConnection" command
*
* @return a Connection object
*/
public Connection getActiveConnection() {
return new Connection(Dispatch.get(this, "ActiveConnection")
.toDispatch());
}
/**
* Sets the "ActiveConnection" object
*
* @param ppvObject
* the new connection
*/
public void setActiveConnection(Connection ppvObject) {
Dispatch.put(this, "ActiveConnection", ppvObject);
}
/**
*
* @return the results from "CommandText"
*/
public String getCommandText() {
return Dispatch.get(this, "CommandText").toString();
}
/**
*
* @param pbstr
* the new "CommandText"
*/
public void setCommandText(String pbstr) {
Dispatch.put(this, "CommandText", pbstr);
}
/**
*
* @return the results of "CommandTimeout"
*/
public int getCommandTimeout() {
return Dispatch.get(this, "CommandTimeout").getInt();
}
/**
*
* @param plTimeout
* the new "CommandTimeout"
*/
public void setCommandTimeout(int plTimeout) {
Dispatch.put(this, "CommandTimeout", new Variant(plTimeout));
}
/**
*
* @return results from "Prepared"
*/
public boolean getPrepared() {
return Dispatch.get(this, "Prepared").getBoolean();
}
/**
*
* @param pfPrepared
* the new value for "Prepared"
*/
public void setPrepared(boolean pfPrepared) {
Dispatch.put(this, "Prepared", new Variant(pfPrepared));
}
/**
* "Execute"s a command
*
* @param RecordsAffected
* @param Parameters
* @param Options
* @return
*/
public Recordset Execute(Variant RecordsAffected, Variant Parameters,
int Options) {
return (Recordset) Dispatch.call(this, "Execute", RecordsAffected,
Parameters, new Variant(Options)).toDispatch();
}
/**
* "Execute"s a command
*
* @return
*/
public Recordset Execute() {
Variant dummy = new Variant();
return new Recordset(Dispatch.call(this, "Execute", dummy).toDispatch());
}
/**
* creates a parameter
*
* @param Name
* @param Type
* @param Direction
* @param Size
* @param Value
* @return
*/
public Variant CreateParameter(String Name, int Type, int Direction,
int Size, Variant Value) {
return Dispatch.call(this, "CreateParameter", Name, new Variant(Type),
new Variant(Direction), new Variant(Size), Value);
}
// need to wrap Parameters
/**
* @return "Parameters"
*/
public Variant getParameters() {
return Dispatch.get(this, "Parameters");
}
/**
*
* @param plCmdType
* new "CommandType"
*/
public void setCommandType(int plCmdType) {
Dispatch.put(this, "CommandType", new Variant(plCmdType));
}
/**
*
* @return current "CommandType"
*/
public int getCommandType() {
return Dispatch.get(this, "CommandType").getInt();
}
/**
*
* @return "Name"
*/
public String getName() {
return Dispatch.get(this, "Name").toString();
}
/**
*
* @param pbstrName
* new "Name"
*/
public void setName(String pbstrName) {
Dispatch.put(this, "Name", pbstrName);
}
/**
*
* @return curent "State"
*/
public int getState() {
return Dispatch.get(this, "State").getInt();
}
/**
* cancel whatever it is we're doing
*/
public void Cancel() {
Dispatch.call(this, "Cancel");
}
}

View File

@@ -0,0 +1,13 @@
package com.jacob.samples.ado;
// Enum: CommandTypeEnum
public interface CommandTypeEnum {
public static final int adCmdUnspecified = -1;
public static final int adCmdUnknown = 8;
public static final int adCmdText = 1;
public static final int adCmdTable = 2;
public static final int adCmdStoredProc = 4;
public static final int adCmdFile = 256;
public static final int adCmdTableDirect = 512;
}

View File

@@ -0,0 +1,151 @@
package com.jacob.samples.ado;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Connection extends Dispatch {
public Connection() {
super("ADODB.Connection");
}
/**
* This constructor is used instead of a case operation to turn a Dispatch
* object into a wider object - it must exist in every wrapper class whose
* instances may be returned from method calls wrapped in VT_DISPATCH
* Variants.
*/
public Connection(Dispatch d) {
super(d);
}
// need to wrap Properties
public Variant getProperties() {
return Dispatch.get(this, "Properties");
}
public String getConnectionString() {
return Dispatch.get(this, "ConnectionString").toString();
}
public void setConnectionString(String pbstr) {
Dispatch.put(this, "ConnectionString", pbstr);
}
public int getCommandTimeout() {
return Dispatch.get(this, "CommandTimeout").getInt();
}
public void setCommandTimeout(int plTimeout) {
Dispatch.put(this, "CommandTimeout", new Variant(plTimeout));
}
public int getConnectionTimeout() {
return Dispatch.get(this, "ConnectionTimeout").getInt();
}
public void setConnectionTimeout(int plTimeout) {
Dispatch.put(this, "ConnectionTimeout", new Variant(plTimeout));
}
public String getVersion() {
return Dispatch.get(this, "Version").toString();
}
public void Close() {
Dispatch.call(this, "Close");
}
// how to deal with RecordsAffected being output?
public Variant Execute(String CommandText, Variant RecordsAffected,
int Options) {
return Dispatch.call(this, CommandText, RecordsAffected, new Variant(
Options));
}
public int BeginTrans() {
return Dispatch.call(this, "BeginTrans").getInt();
}
public void CommitTrans() {
Dispatch.call(this, "CommitTrans");
}
public void RollbackTrans() {
Dispatch.call(this, "RollbackTrans");
}
public void Open(String ConnectionString, String UserID, String Password,
int Options) {
Dispatch.call(this, "Open", ConnectionString, UserID, Password,
new Variant(Options));
}
public void Open() {
Dispatch.call(this, "Open");
}
public Variant getErrors() {
return Dispatch.get(this, "Errors");
}
public String getDefaultDatabase() {
return Dispatch.get(this, "DefaultDatabase").toString();
}
public void setDefaultDatabase(String pbstr) {
Dispatch.put(this, "DefaultDatabase", pbstr);
}
public int getIsolationLevel() {
return Dispatch.get(this, "IsolationLevel").getInt();
}
public void setIsolationLevel(int Level) {
Dispatch.put(this, "IsolationLevel", new Variant(Level));
}
public int getAttributes() {
return Dispatch.get(this, "Attributes").getInt();
}
public void setAttributes(int plAttr) {
Dispatch.put(this, "Attributes", new Variant(plAttr));
}
public int getCursorLocation() {
return Dispatch.get(this, "CursorLocation").getInt();
}
public void setCursorLocation(int plCursorLoc) {
Dispatch.put(this, "CursorLocation", new Variant(plCursorLoc));
}
public int getMode() {
return Dispatch.get(this, "Mode").getInt();
}
public void setMode(int plMode) {
Dispatch.put(this, "Mode", new Variant(plMode));
}
public String getProvider() {
return Dispatch.get(this, "Provider").toString();
}
public void setProvider(String pbstr) {
Dispatch.put(this, "Provider", pbstr);
}
public int getState() {
return Dispatch.get(this, "State").getInt();
}
public Variant OpenSchema(int Schema, Variant Restrictions, Variant SchemaID) {
return Dispatch.call(this, "OpenSchema", new Variant(Schema),
Restrictions, SchemaID);
}
public void Cancel() {
Dispatch.call(this, "Cancel");
}
}

View File

@@ -0,0 +1,101 @@
package com.jacob.samples.ado;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Field extends Dispatch {
/**
* This constructor is used instead of a case operation to turn a Dispatch
* object into a wider object - it must exist in every wrapper class whose
* instances may be returned from method calls wrapped in VT_DISPATCH
* Variants.
*/
public Field(Dispatch d) {
super(d);
}
public Variant getProperties() {
return Dispatch.get(this, "Properties");
}
public int getActualSize() {
return Dispatch.get(this, "ActualSize").getInt();
}
public int getAttributes() {
return Dispatch.get(this, "Attributes").getInt();
}
public int getDefinedSize() {
return Dispatch.get(this, "DefinedSize").getInt();
}
public String getName() {
return Dispatch.get(this, "Name").toString();
}
public int getType() {
return Dispatch.get(this, "Type").getInt();
}
public Variant getValue() {
return Dispatch.get(this, "Value");
}
public void setValue(Variant pvar) {
Dispatch.put(this, "Value", pvar);
}
public byte getPrecision() {
return Dispatch.get(this, "Precision").getByte();
}
public byte getNumericScale() {
return Dispatch.get(this, "NumericScale").getByte();
}
public void AppendChunk(Variant Data) {
Dispatch.call(this, "AppendChunk", Data);
}
public Variant GetChunk(int Length) {
return Dispatch.call(this, "GetChunk", new Variant(Length));
}
public Variant getOriginalValue() {
return Dispatch.get(this, "OriginalValue");
}
public Variant getUnderlyingValue() {
return Dispatch.get(this, "UnderlyingValue");
}
public Variant getDataFormat() {
return Dispatch.get(this, "DataFormat");
}
public void setDataFormat(Variant ppiDF) {
Dispatch.put(this, "DataFormat", ppiDF);
}
public void setPrecision(byte pb) {
Dispatch.put(this, "Precision", new Variant(pb));
}
public void setNumericScale(byte pb) {
Dispatch.put(this, "NumericScale", new Variant(pb));
}
public void setType(int pDataType) {
Dispatch.put(this, "Type", new Variant(pDataType));
}
public void setDefinedSize(int pl) {
Dispatch.put(this, "DefinedSize", new Variant(pl));
}
public void setAttributes(int pl) {
Dispatch.put(this, "Attributes", new Variant(pl));
}
}

View File

@@ -0,0 +1,43 @@
package com.jacob.samples.ado;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Fields extends Dispatch {
/**
* This constructor is used instead of a case operation to turn a Dispatch
* object into a wider object - it must exist in every wrapper class whose
* instances may be returned from method calls wrapped in VT_DISPATCH
* Variants.
*/
public Fields(Dispatch d) {
super(d);
}
public int getCount() {
return Dispatch.get(this, "Count").getInt();
}
public Variant _NewEnum() {
return Dispatch.call(this, "_NewEnum");
}
public void Refresh() {
Dispatch.call(this, "Refresh");
}
public Field getItem(int Index) {
return new Field(Dispatch.call(this, "Item", new Variant(Index))
.toDispatch());
}
public void Append(String Name, int Type, int DefinedSize, int Attrib) {
Dispatch.call(this, "Append", Name, new Variant(Type), new Variant(
DefinedSize), new Variant(Attrib));
}
public void Delete(Variant Index) {
Dispatch.call(this, "Delete", Index);
}
}

View File

@@ -0,0 +1,342 @@
package com.jacob.samples.ado;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Recordset extends Dispatch {
public Recordset() {
super("ADODB.Recordset");
}
/**
* This constructor is used instead of a case operation to turn a Dispatch
* object into a wider object - it must exist in every wrapper class whose
* instances may be returned from method calls wrapped in VT_DISPATCH
* Variants.
*/
public Recordset(Dispatch d) {
super(d);
}
public Variant getProperties() {
return Dispatch.get(this, "Properties");
}
public int getAbsolutePosition() {
return Dispatch.get(this, "AbsolutePosition").getInt();
}
public void setAbsolutePosition(int pl) {
Dispatch.put(this, "AbsolutePosition", new Variant(pl));
}
public Connection getActiveConnection() {
return new Connection(Dispatch.get(this, "ActiveConnection")
.toDispatch());
}
public void setActiveConnection(Connection ppvObject) {
Dispatch.put(this, "ActiveConnection", ppvObject);
}
public void setActiveConnection(Variant ppvObject) {
Dispatch.put(this, "ActiveConnection", ppvObject);
}
public boolean getBOF() {
return Dispatch.get(this, "BOF").getBoolean();
}
public Variant getBookmark() {
return Dispatch.get(this, "Bookmark");
}
public void setBookmark(Variant pvBookmark) {
Dispatch.put(this, "Bookmark", pvBookmark);
}
public int getCacheSize() {
return Dispatch.get(this, "CacheSize").getInt();
}
public void setCacheSize(int pl) {
Dispatch.put(this, "CacheSize", new Variant(pl));
}
public int getCursorType() {
return Dispatch.get(this, "CursorType").getInt();
}
public void setCursorType(int pl) {
Dispatch.put(this, "CursorType", new Variant(pl));
}
public boolean getEOF() {
return Dispatch.get(this, "EOF").getBoolean();
}
public Fields getFields() {
return new Fields(Dispatch.get(this, "Fields").toDispatch());
}
public int getLockType() {
return Dispatch.get(this, "LockType").getInt();
}
public void setLockType(int plLockType) {
Dispatch.put(this, "LockType", new Variant(plLockType));
}
public int getMaxRecords() {
return Dispatch.get(this, "MaxRecords").getInt();
}
public void setMaxRecords(int pl) {
Dispatch.put(this, "MaxRecords", new Variant(pl));
}
public int getRecordCount() {
return Dispatch.get(this, "RecordCount").getInt();
}
public void setSource(Object pvSource) {
Dispatch.put(this, "Source", pvSource);
}
public void setSource(String pvSource) {
Dispatch.put(this, "Source", pvSource);
}
public Variant getSource() {
return Dispatch.get(this, "Source");
}
public void AddNew(Variant FieldList, Variant Values) {
Dispatch.call(this, "AddNew", FieldList, Values);
}
public void CancelUpdate() {
Dispatch.call(this, "CancelUpdate");
}
public void Close() {
Dispatch.call(this, "Close");
}
public void Delete(int AffectRecords) {
Dispatch.call(this, "Delete", new Variant(AffectRecords));
}
public Variant GetRows(int Rows, Variant Start, Variant Fields) {
return Dispatch.call(this, "GetRows", new Variant(Rows), Start, Fields);
}
// get all rows
public Variant GetRows() {
return Dispatch.call(this, "GetRows");
}
public void Move(int NumRecords, Variant Start) {
Dispatch.call(this, "Move", new Variant(NumRecords), Start);
}
public void MoveNext() {
Dispatch.call(this, "MoveNext");
}
public void MovePrevious() {
Dispatch.call(this, "MovePrevious");
}
public void MoveFirst() {
Dispatch.call(this, "MoveFirst");
}
public void MoveLast() {
Dispatch.call(this, "MoveLast");
}
public void Open(Variant Source, Variant ActiveConnection, int CursorType,
int LockType, int Options) {
Dispatch.call(this, "Open", Source, ActiveConnection, new Variant(
CursorType), new Variant(LockType), new Variant(Options));
}
public void Open(Variant Source, Variant ActiveConnection) {
Dispatch.call(this, "Open", Source, ActiveConnection);
}
public void Requery(int Options) {
Dispatch.call(this, "Requery", new Variant(Options));
}
public void Update(Variant Fields, Variant Values) {
Dispatch.call(this, "Update", Fields, Values);
}
public int getAbsolutePage() {
return Dispatch.get(this, "AbsolutePage").getInt();
}
public void setAbsolutePage(int pl) {
Dispatch.put(this, "AbsolutePage", new Variant(pl));
}
public int getEditMode() {
return Dispatch.get(this, "EditMode").getInt();
}
public Variant getFilter() {
return Dispatch.get(this, "Filter");
}
public void setFilter(Variant Criteria) {
Dispatch.put(this, "Filter", Criteria);
}
public int getPageCount() {
return Dispatch.get(this, "PageCount").getInt();
}
public int getPageSize() {
return Dispatch.get(this, "PageSize").getInt();
}
public void setPageSize(int pl) {
Dispatch.put(this, "PageSize", new Variant(pl));
}
public String getSort() {
return Dispatch.get(this, "Sort").toString();
}
public void setSort(String Criteria) {
Dispatch.put(this, "Sort", Criteria);
}
public int getStatus() {
return Dispatch.get(this, "Status").getInt();
}
public int getState() {
return Dispatch.get(this, "State").getInt();
}
public void UpdateBatch(int AffectRecords) {
Dispatch.call(this, "UpdateBatch", new Variant(AffectRecords));
}
public void CancelBatch(int AffectRecords) {
Dispatch.call(this, "CancelBatch", new Variant(AffectRecords));
}
public int getCursorLocation() {
return Dispatch.get(this, "CursorLocation").getInt();
}
public void setCursorLocation(int pl) {
Dispatch.put(this, "CursorLocation", new Variant(pl));
}
public Recordset NextRecordset(Variant RecordsAffected) {
return new Recordset(Dispatch.call(this, "NextRecordset",
RecordsAffected).toDispatch());
}
public boolean Supports(int CursorOptions) {
return Dispatch.call(this, "Supports", new Variant(CursorOptions))
.getBoolean();
}
public Variant getCollect(Variant Index) {
return Dispatch.get(this, "Collect");
}
public void setCollect(Variant Index, Variant pvar) {
Dispatch.call(this, "Collect", Index, pvar);
}
public int getMarshalOptions() {
return Dispatch.get(this, "MarshalOptions").getInt();
}
public void setMarshalOptions(int pl) {
Dispatch.put(this, "MarshalOptions", new Variant(pl));
}
public void Find(String Criteria, int SkipRecords, int SearchDirection,
Variant Start) {
Dispatch.call(this, "Find", Criteria, new Variant(SkipRecords),
new Variant(SearchDirection), Start);
}
public void Cancel() {
Dispatch.call(this, "Cancel");
}
public Variant getDataSource() {
return Dispatch.get(this, "DataSource");
}
public void setDataSource(Variant ppunkDataSource) {
Dispatch.put(this, "DataSource", ppunkDataSource);
}
public void Save(String FileName, int PersistFormat) {
Dispatch.call(this, "Save", FileName, new Variant(PersistFormat));
}
public Variant getActiveCommand() {
return Dispatch.get(this, "ActiveCommand");
}
public void setStayInSync(boolean pb) {
Dispatch.put(this, "StayInSync", new Variant(pb));
}
public boolean getStayInSync() {
return Dispatch.get(this, "StayInSync").getBoolean();
}
public String GetString(int StringFormat, int NumRows,
String ColumnDelimeter, String RowDelimeter, String NullExpr) {
return Dispatch.call(this, "GetString", new Variant(StringFormat),
new Variant(NumRows), ColumnDelimeter, RowDelimeter, NullExpr)
.toString();
}
public String getDataMember() {
return Dispatch.get(this, "DataMember").toString();
}
public void setDataMember(String pl) {
Dispatch.put(this, "DataMember", new Variant(pl));
}
public int CompareBookmarks(Variant Bookmark1, Variant Bookmark2) {
return Dispatch.call(this, "CompareBookmarks", Bookmark1, Bookmark2)
.getInt();
}
public Recordset Clone(int LockType) {
return new Recordset(Dispatch
.call(this, "Clone", new Variant(LockType)).toDispatch());
}
public void Resync(int AffectRecords, int ResyncValues) {
Dispatch.call(this, "Resync", new Variant(AffectRecords), new Variant(
ResyncValues));
}
public void Seek(Variant KeyValues, int SeekOption) {
Dispatch.call(this, "Seek", KeyValues, new Variant(SeekOption));
}
public void setIndex(String pl) {
Dispatch.put(this, "Index", new Variant(pl));
}
public String getIndex() {
return Dispatch.get(this, "Index)").toString();
}
}

View File

@@ -0,0 +1,9 @@
This is the WFC equivalent of the JACOB ADO example.
This code must be compiled with JVC and run with JVIEW.
The file testms.java has been renamed to tesetms.java.txt
because most folks building this application will
not have the MS JVM installed and will get compiler
warnings. The MS JVM is going away eventually
so this whole test will eventually go away.

View File

@@ -0,0 +1,66 @@
package samples.ado.ms;
import com.ms.com.*;
import com.ms.wfc.data.*;
// an ms-only version of test.java
public class testms
{
public static void printRS(Recordset rs)
{
Fields fs = rs.getFields();
for (int i=0;i<fs.getCount();i++)
{
System.out.print(fs.getItem(i).getName() + " ");
}
System.out.println("");
rs.moveFirst();
while (!rs.getEOF())
{
for(int i=0;i<fs.getCount();i++)
{
Field f = fs.getItem(i);
Variant v = f.getValue();
System.out.print(v + " ");
}
System.out.println("");
rs.moveNext();
}
}
// open a recordset directly
public static void getRS(String con, String query)
{
System.out.println("Recordset Open");
Recordset rs = new Recordset();
rs.open(new Variant(query), new Variant(con));
printRS(rs);
}
// create connection and command objects and use them
// to get a recordset
public static void getCommand(String con, String query)
{
System.out.println("Command+Connection -> Recordset");
Connection c = new Connection();
c.setConnectionString(con);
c.open();
Command comm = new Command();
comm.setActiveConnection(c);
comm.setCommandType(AdoEnums.CommandType.TEXT);
comm.setCommandText(query);
Recordset rs = comm.execute();
printRS(rs);
c.close();
}
public static void main(String[] args)
{
String connectStr = "DRIVER=SQL Server;SERVER=DANADLER;UID=sa;PWD=;WSID=DANADLER;DATABASE=pubs";
String queryStr = "select * from authors";
getCommand(connectStr, queryStr);
getRS(connectStr, queryStr);
}
}

View File

@@ -0,0 +1,56 @@
package com.jacob.samples.ado;
import com.jacob.com.Variant;
public class test {
public static void printRS(Recordset rs) {
Fields fs = rs.getFields();
for (int i = 0; i < fs.getCount(); i++) {
System.out.print(fs.getItem(i).getName() + " ");
}
System.out.println("");
rs.MoveFirst();
while (!rs.getEOF()) {
for (int i = 0; i < fs.getCount(); i++) {
Field f = fs.getItem(i);
Variant v = f.getValue();
System.out.print(v + " ");
}
System.out.println("");
rs.MoveNext();
}
}
// open a recordset directly
public static void getRS(String con, String query) {
System.out.println("Recordset Open");
Recordset rs = new Recordset();
rs.Open(new Variant(query), new Variant(con));
printRS(rs);
}
// create connection and command objects and use them
// to get a recordset
public static void getCommand(String con, String query) {
System.out.println("Command+Connection -> Recordset");
Connection c = new Connection();
c.setConnectionString(con);
c.Open();
Command comm = new Command();
comm.setActiveConnection(c);
comm.setCommandType(CommandTypeEnum.adCmdText);
comm.setCommandText(query);
Recordset rs = comm.Execute();
printRS(rs);
c.Close();
}
public static void main(String[] args) {
String connectStr = "DRIVER=SQL Server;SERVER=DANADLER;UID=sa;PWD=;WSID=DANADLER;DATABASE=pubs";
String queryStr = "select * from authors";
getCommand(connectStr, queryStr);
getRS(connectStr, queryStr);
}
}

View File

@@ -0,0 +1,8 @@
<title>Applet Test (1.1)</title>
<h1>Applet Test (1.1)</h1>
<hr>
<applet code=AppTest.class width=400 height=400>
</applet>
<hr>
<a href="AppTest.java">The source.</a>
<br>

View File

@@ -0,0 +1,20 @@
<html>
<head>
<title>Jacob Test Applet</title>
</head>
<body>
<applet code="com.jacob.samples.applet.JacobTestApplet"
name="JacobTestApplet"
width="400"
height="50"
alt="Please install java first! (Java is available for free at www.java.com)">
<param name="jnlp_href" value="Applet.jnlp">
Java is not working! Several reasons:<br/>
1.) Your Browser is not able to execute java (-> get a different browser e.g. firefox.com)<br/>
2.) Java is not installed (-> install java e.g. java.com)<br/>
3.) Java is disabled/deactivated (-> enable java in your web browser)<br/>
4.) Your security settings are too tight (->enable java the settings)<br/>
5.) Contact support @ nepatec<br/>
</applet>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<jnlp href="Applet.jnlp" spec="1.0+" version="1.1">
<information>
<title>Jacob Test Applet</title>
<vendor>ttreeck, nepatec GmbH &amp; Co. KG</vendor>
<offline-allowed />
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.6.0_20+" />
<jar href="lib/JacobTestApplet.jar-selfSigned.jar" main="true" version="1.0.0" />
<jar href="lib/jacob-signed.jar" version="1.0.0" />
<nativelib href="lib/jacob-dll-1.15-M3-signed.jar"/>
</resources>
<applet-desc
name="JacobTestApplet"
main-class="com.jacob.samples.applet.JacobTestApplet"
width="400"
height="50">
</applet-desc>
</jnlp>

View File

@@ -0,0 +1,88 @@
package com.jacob.samples.applet;
import java.applet.Applet;
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
* Example applet to demonstrate:
* 1. The use of jacob from an applet
* 2. To show how to distribute the jacob native lib with the applet (also works with webstart)
*
* Comment on 2.:
* The way shown here is quite straight forward and it is not necessary to use
* a mechanism like the "DLLFromJARClassLoader" or something similar...
*
* @author ttreeck, www.nepatec.de
*
*/
public class JacobTestApplet extends Applet implements ActionListener {
private static final long serialVersionUID = 4492492907986849158L;
TextField in;
TextField out;
Button calc;
ActiveXComponent sC = null;
/**
* startup method
*/
@Override
public void init() {
setLayout(new FlowLayout());
add(this.in = new TextField("1+1", 16));
add(this.out = new TextField("?", 16));
add(this.calc = new Button("Calculate"));
this.calc.addActionListener(this);
}
/**
* Returns information about this applet.
* According to the java spec:
* "An applet should override this method to return a String containing information about the author, version, and copyright of the applet."
*
* @return information about the applet.
*/
@Override
public String getAppletInfo() {
return "Jacob Test Applet. Written by ttreeck, nepatec GmbH & Co. KG.\nhttp://www.nepatec.de";
}
/**
* Returns information about the parameters that are understood by this applet.
* According to the java spec:
* "An applet should override this method to return an array of Strings describing these parameters."
*
* @return array with a set of three Strings containing the name, the type, and a description.
*/
@Override
public String[][] getParameterInfo(){
return new String[][]{};
}
/**
* action method that receives button actions
*
* @param ev the event
*/
public void actionPerformed(ActionEvent ev) {
if (this.sC == null) {
String lang = "VBScript";
this.sC = new ActiveXComponent("ScriptControl");
Dispatch.put(this.sC, "Language", lang);
}
Variant v = Dispatch.call(this.sC, "Eval", this.in.getText());
this.out.setText(v.toString());
}
}

View File

@@ -0,0 +1,59 @@
There is an easy and elegant way to load DLLs from Applets and JavaWebStart Applications.
Both JavaWebStart and Applets support JNLP (Applets since 1.6.0_10 aka plugin2).
Within a jnlp file it is possible to specify a nativelib and that's it!
So what do you need to do?
1.) package the jacob-1.XX-xXX.dll into a jar file (root level of the jar, not into a subfolder) and put it into your applications lib folder next to your other libs (e.g. jacob.jar)
2.) Specify all your libraries in your jnlp file like this:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp href="MyApplicaton.jnlp" spec="1.0+" version="1.1">
<information>
<title>My cool Application or Applet</title>
<vendor>nepatec GmbH &amp; Co. KG</vendor>
<offline-allowed />
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.6.0_10+" />
<jar href="MyCoolApp.jar" main="true" version="1.0.0" />
<jar href="jacob.jar" version="1.0.0" />
<nativelib href="jacob-1.XX-xXX.jar"/>
</resources>
<!-- Use either this for an applet -->
<applet-desc
name="MyCoolApp"
main-class="de.nepatec.app.MyCoolApplet"
width="265"
height="60">
</applet-desc>
<!-- or this for an web start application -->
<application-desc main-class="de.nepatec.app.MyCoolApp">
<argument>some crazy arguments</argument>
</application-desc>
</jnlp>
3.) Sign all the jars or set up a policy file (cp. Applet Security below)
4.) Deploy your application and start it via webstart or as an applet (from an webpage)
General comments:
- If you sign the jar files you need the <security> tag - when using a policy file it can be removed
- furthermore it is recommended that all libs are signed with an official certificate (e.g. from verisign, thawte etc) so that the browser doesn't pop a warning stating 'untrusted' application...
- to check the validity of your jnlp file the tool JaNeLA (link cp. sources below) is recommended.
[Sources]
New Applet: https://jdk6.dev.java.net/plugin2/
Applet JNLP: https://jdk6.dev.java.net/plugin2/jnlp/
Applet Security: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/appA.html
JNLP API: http://www.oracle.com/technetwork/java/javase/index-141367.html
JNLP Verifier: http://pscode.org/janela/

View File

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

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

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

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

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

View File

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

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

@@ -0,0 +1,571 @@
/* 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

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

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

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

@@ -0,0 +1,56 @@
/* 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

@@ -0,0 +1,570 @@
/* 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

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

View File

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

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

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

@@ -0,0 +1,38 @@
/*********************************************************
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

@@ -0,0 +1,18 @@
//{{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

@@ -0,0 +1,46 @@
package com.jacob.samples.atl;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
class MultiFaceTest {
/**
* standard main() test program
*
* @param args
* the command line arguments
*/
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

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

@@ -0,0 +1,52 @@
package com.jacob.samples.office;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
* Sample test program snagged out of a question on the sun discussion area.
* <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 ExcelDispatchTest {
/**
* main run loop for test program
*
* @param args
* standard command line arguments
*/
public static void main(String[] args) {
ComThread.InitSTA();
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
try {
System.out.println("version=" + xl.getProperty("Version"));
System.out.println("version=" + Dispatch.get(xl, "Version"));
Dispatch.put(xl, "Visible", new Variant(true));
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
Dispatch workbook = Dispatch.get(workbooks, "Add").toDispatch();
Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch();
Dispatch a1 = Dispatch.invoke(sheet, "Range", Dispatch.Get,
new Object[] { "A1" }, new int[1]).toDispatch();
Dispatch a2 = Dispatch.invoke(sheet, "Range", Dispatch.Get,
new Object[] { "A2" }, new int[1]).toDispatch();
Dispatch.put(a1, "Value", "123.456");
Dispatch.put(a2, "Formula", "=A1*2");
System.out.println("a1 from excel:" + Dispatch.get(a1, "Value"));
System.out.println("a2 from excel:" + Dispatch.get(a2, "Value"));
Variant f = new Variant(false);
Dispatch.call(workbook, "Close", f);
} catch (Exception e) {
e.printStackTrace();
} finally {
xl.invoke("Quit", new Variant[] {});
ComThread.Release();
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,48 @@
package com.jacob.samples.office;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComFailException;
import com.jacob.com.Dispatch;
/**
* Snippet to show Visio print dialog
* <p>
* Sample submitted by fatbuttlarry in SourceForge 1803140 as part of bug report
* <p>
* Tested with Java 6.0SE and MS Office 2003 ** Note: 1010 = VB's
* visCmdFilePrint constant
*/
public class VisioPrintTest {
/**
* Runs the print ant lets the user say ok or cancel. Note the funky Visio
* behavior if someone hits the cancel button
*
*/
public void testPrintDialog() {
ActiveXComponent oActiveX = new ActiveXComponent("Visio.Application");
Dispatch oDocuments = oActiveX.getProperty("Documents").toDispatch();
// create a blank document
Dispatch.call(oDocuments, "Add", "");
try {
Dispatch.call(oActiveX, "DoCmd", new Integer(1010)).getInt();
System.out.println("User hit the ok button.");
} catch (ComFailException e) {
System.out.println("User hit the cancel button: " + e);
} finally {
oActiveX.invoke("Quit");
}
return;
}
/**
* quick main() to test this
*
* @param args
* standard command line arguments
*/
public static void main(String[] args) {
VisioPrintTest testObject = new VisioPrintTest();
testObject.testPrintDialog();
}
}

View File

@@ -0,0 +1,171 @@
package com.jacob.samples.office;
import java.io.File;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
* Submitted to the Jacob SourceForge web site as a sample 3/2005
* <p>
* This sample is BROKEN because it doesn't call quit!
*
* @author Date Created Description Jason Twist 04 Mar 2005 Code opens a locally
* stored Word document and extracts the Built In properties and Custom
* properties from it. This code just gives an intro to JACOB and there
* are sections that could be enhanced
*/
public class WordDocumentProperties {
// Declare word object
private ActiveXComponent objWord;
// Declare Word Properties
private Dispatch custDocprops;
private Dispatch builtInDocProps;
// the doucments object is important in any real app but this demo doesn't
// use it
// private Dispatch documents;
private Dispatch document;
private Dispatch wordObject;
/**
* Empty Constructor
*
*/
public WordDocumentProperties() {
}
/**
* Opens a document
*
* @param filename
*/
public void open(String filename) {
// Instantiate objWord
objWord = new ActiveXComponent("Word.Application");
// Assign a local word object
wordObject = objWord.getObject();
// Create a Dispatch Parameter to hide the document that is opened
Dispatch.put(wordObject, "Visible", new Variant(false));
// Instantiate the Documents Property
Dispatch documents = objWord.getProperty("Documents").toDispatch();
// Open a word document, Current Active Document
document = Dispatch.call(documents, "Open", filename).toDispatch();
}
/**
* Creates an instance of the VBA CustomDocumentProperties property
*
*/
public void selectCustomDocumentProperitiesMode() {
// Create CustomDocumentProperties and BuiltInDocumentProperties
// properties
custDocprops = Dispatch.get(document, "CustomDocumentProperties")
.toDispatch();
}
/**
* Creates an instance of the VBA BuiltInDocumentProperties property
*
*/
public void selectBuiltinPropertiesMode() {
// Create CustomDocumentProperties and BuiltInDocumentProperties
// properties
builtInDocProps = Dispatch.get(document, "BuiltInDocumentProperties")
.toDispatch();
}
/**
* Closes a document
*
*/
public void close() {
// Close object
Dispatch.call(document, "Close");
}
/**
* Custom Property Name is passed in
*
* @param cusPropName
* @return String - Custom property value
*/
public String getCustomProperty(String cusPropName) {
try {
cusPropName = Dispatch.call(custDocprops, "Item", cusPropName)
.toString();
} catch (ComException e) {
// Do nothing
cusPropName = null;
}
return cusPropName;
}
/**
* Built In Property Name is passed in
*
* @param builtInPropName
* @return String - Built in property value
*/
public String getBuiltInProperty(String builtInPropName) {
try {
builtInPropName = Dispatch.call(builtInDocProps, "Item",
builtInPropName).toString();
} catch (ComException e) {
// Do nothing
builtInPropName = null;
}
return builtInPropName;
}
/**
* simple main program that gets some properties and prints them out
*
* @param args
*/
public static void main(String[] args) {
try {
// Instantiate the class
WordDocumentProperties jacTest = new WordDocumentProperties();
// Open the word doc
File doc = new File(
"samples/com/jacob/samples/office/TestDocument.doc");
jacTest.open(doc.getAbsolutePath());
// Set Custom Properties
jacTest.selectCustomDocumentProperitiesMode();
// Set Built In Properties
jacTest.selectBuiltinPropertiesMode();
// Get custom Property Value
String custValue = jacTest.getCustomProperty("Information Source");
// Get built in prroperty Property Value
String builtInValue = jacTest.getBuiltInProperty("Author");
// Close Word Doc
jacTest.close();
// Output data
System.out.println("Document Val One: " + custValue);
System.out.println("Document Author: " + builtInValue);
} catch (Exception e) {
System.out.println(e);
}
}
}

View File

@@ -0,0 +1,80 @@
package com.jacob.samples.outlook;
/**
* JACOB Outlook sample contributed by
* Christopher Brind <christopher.brind@morse.com>
*/
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
* sample class to show simple outlook manipulation
*/
public class Outlook {
private static String pad(int i) {
StringBuffer sb = new StringBuffer();
while (sb.length() < i) {
sb.append(' ');
}
return sb.toString();
}
private static void recurseFolders(int iIndent, Dispatch o) {
if (o == null) {
return;
}
Dispatch oFolders = Dispatch.get(o, "Folders").toDispatch();
// System.out.println("oFolders=" + oFolders);
if (oFolders == null) {
return;
}
Dispatch oFolder = Dispatch.get(oFolders, "GetFirst").toDispatch();
do {
Object oFolderName = Dispatch.get(oFolder, "Name");
if (null == oFolderName) {
break;
}
System.out.println(pad(iIndent) + oFolderName);
recurseFolders(iIndent + 3, oFolder);
oFolder = Dispatch.get(oFolders, "GetNext").toDispatch();
} while (true);
}
/**
* standard run loop
*
* @param asArgs
* command line arguments
* @throws Exception
*/
public static void main(String asArgs[]) throws Exception {
System.out.println("Outlook: IN");
ActiveXComponent axOutlook = new ActiveXComponent("Outlook.Application");
try {
System.out.println("version=" + axOutlook.getProperty("Version"));
Dispatch oOutlook = axOutlook.getObject();
System.out.println("version=" + Dispatch.get(oOutlook, "Version"));
Dispatch oNameSpace = axOutlook.getProperty("Session").toDispatch();
System.out.println("oNameSpace=" + oNameSpace);
recurseFolders(0, oNameSpace);
} finally {
axOutlook.invoke("Quit", new Variant[] {});
}
}
}

View File

@@ -0,0 +1,152 @@
package com.jacob.samples.system;
import java.text.DecimalFormat;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
/**
* Example VB script that grabs hard drive properties.
* <p>
* Source Forge posting
* http://sourceforge.net/forum/forum.php?thread_id=1785936&forum_id=375946
* <p>
* Enhance by clay_shooter with info from
* http://msdn2.microsoft.com/en-us/library/d6dw7aeh.aspx
*
* @author qstephenson
*
*/
public class DiskUtils {
/** formatters aren't thread safe but the sample only has one thread */
private static DecimalFormat sizeFormatter = new DecimalFormat(
"###,###,###,###");
/** a pointer to the scripting file system object */
private ActiveXComponent fileSystemApp = null;
/** the dispatch that points at the drive this DiskUtil operates against */
private Dispatch myDrive = null;
/**
* Standard constructor
*
* @param drive
* the drive to run the test against.
*/
public DiskUtils(String drive) {
setUp(drive);
}
/**
* open the connection to the scripting object
*
* @param drive
* the drive to run the test against
*/
public void setUp(String drive) {
if (fileSystemApp == null) {
ComThread.InitSTA();
fileSystemApp = new ActiveXComponent("Scripting.FileSystemObject");
myDrive = Dispatch.call(fileSystemApp, "GetDrive", drive)
.toDispatch();
}
}
/**
* Do any needed cleanup
*/
public void tearDown() {
ComThread.Release();
}
/**
* convenience method
*
* @return driver serial number
*/
public int getSerialNumber() {
return Dispatch.get(myDrive, "SerialNumber").getInt();
}
/**
* Convenience method. We go through these formatting hoops so we can make
* the size string pretty. We wouldn't have to do that if we didn't mind
* long strings with Exxx at the end or the fact that the value returned can
* vary in size based on the size of the disk.
*
* @return driver total size of the disk
*/
public String getTotalSize() {
Variant returnValue = Dispatch.get(myDrive, "TotalSize");
if (returnValue.getvt() == Variant.VariantDouble) {
return sizeFormatter.format(returnValue.getDouble());
} else if (returnValue.getvt() == Variant.VariantInt) {
return sizeFormatter.format(returnValue.getInt());
} else {
return "Don't know type: " + returnValue.getvt();
}
}
/**
* Convenience method. We wouldn't have to do that if we didn't mind long
* strings with Exxx at the end or the fact that the value returned can vary
* in size based on the size of the disk.
*
* @return driver free size of the disk
*/
public String getFreeSpace() {
Variant returnValue = Dispatch.get(myDrive, "FreeSpace");
if (returnValue.getvt() == Variant.VariantDouble) {
return sizeFormatter.format(returnValue.getDouble());
} else if (returnValue.getvt() == Variant.VariantInt) {
return sizeFormatter.format(returnValue.getInt());
} else {
return "Don't know type: " + returnValue.getvt();
}
}
/**
*
* @return file system on the drive
*/
public String getFileSystemType() {
// figure ot the actual variant type
// Variant returnValue = Dispatch.get(myDrive, "FileSystem");
// System.out.println(returnValue.getvt());
return Dispatch.get(myDrive, "FileSystem").getString();
}
/**
*
* @return volume name
*/
public String getVolumeName() {
return Dispatch.get(myDrive, "VolumeName").getString();
}
/**
* Simple main program that creates a DiskUtils object and queries for the
* C: drive
*
* @param args
* standard command line arguments
*/
public static void main(String[] args) {
// DiskUtils utilConnection = new DiskUtils("F");
DiskUtils utilConnection = new DiskUtils("C");
System.out.println("Disk serial number is: "
+ utilConnection.getSerialNumber());
System.out.println("FileSystem is: "
+ utilConnection.getFileSystemType());
System.out.println("Volume Name is: " + utilConnection.getVolumeName());
System.out.println("Disk total size is: "
+ utilConnection.getTotalSize());
System.out.println("Disk free space is: "
+ utilConnection.getFreeSpace());
utilConnection.tearDown();
}
}

View File

@@ -0,0 +1,75 @@
package com.jacob.samples.system;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.EnumVariant;
import com.jacob.com.Variant;
/**
* Sample program that shows how to talk to WMI on local machine.
*
* This test program was derived from SourceForge question
* http://sourceforge.net/forum/forum.php?thread_id=1831650&forum_id=375946
* fold, spindled and mutilated by clay_shooter
*
* @author chris_knowles
*
*/
public class SystemMonitor {
/**
* example run loop method called by main()
*/
public void runMonitor() {
ActiveXComponent wmi = null;
wmi = new ActiveXComponent("WbemScripting.SWbemLocator");
// no connection parameters means to connect to the local machine
Variant conRet = wmi.invoke("ConnectServer");
// the author liked the ActiveXComponent api style over the Dispatch
// style
ActiveXComponent wmiconnect = new ActiveXComponent(conRet.toDispatch());
// the WMI supports a query language.
String query = "select CategoryString, Message, TimeGenerated, User, Type "
+ "from Win32_NtLogEvent "
+ "where Logfile = 'Application' and TimeGenerated > '20070915000000.000000-***'";
Variant vCollection = wmiconnect
.invoke("ExecQuery", new Variant(query));
EnumVariant enumVariant = new EnumVariant(vCollection.toDispatch());
String resultString = "";
Dispatch item = null;
while (enumVariant.hasMoreElements()) {
resultString = "";
item = enumVariant.nextElement().toDispatch();
String categoryString = Dispatch.call(item, "CategoryString")
.toString();
String messageString = Dispatch.call(item, "Message").toString();
String timeGenerated = Dispatch.call(item, "TimeGenerated")
.toString();
String eventUser = Dispatch.call(item, "User").toString();
String eventType = Dispatch.call(item, "Type").toString();
resultString += "TimeGenerated: " + timeGenerated + " Category: "
+ categoryString + " User: " + eventUser + " EventType: "
+ eventType + " Message:" + messageString;
System.out.println(resultString);
}
}
/**
* sample's main program
*
* @param args
* command line arguments
*/
public static void main(String[] args) {
SystemMonitor utilConnection = new SystemMonitor();
utilConnection.runMonitor();
}
}

View File

@@ -0,0 +1,121 @@
package com.jacob.samples.visio;
import java.io.File;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.DispatchEvents;
import com.jacob.com.Variant;
/**
* Created as part of sourceforge 1386454 to demonstrate returning values in
* event handlers
*
* @author miles@rowansoftware.net
*
* This class represents the visio app itself
*/
public class VisioApp extends ActiveXComponent {
/**
* constructor that spins up Visio
*
* @throws VisioException
*/
public VisioApp() throws VisioException {
super("Visio.Application");
setVisible(false);
}
/**
* creates a DispatchEvents object to register o as a listener
*
* @param o
*/
public void addEventListener(VisioEventListener o) {
DispatchEvents events = new DispatchEvents(this, o);
if (events == null) {
System.out
.println("You should never get null back when creating a DispatchEvents object");
}
}
/**
* opens the passed in file in Visio
*
* @param f
* @throws VisioException
*/
public void open(File f) throws VisioException {
try {
ActiveXComponent documents = new ActiveXComponent(getProperty(
"Documents").toDispatch());
Variant[] args = new Variant[1];
args[0] = new Variant(f.getPath());
documents.invoke("Open", args);
} catch (Exception e) {
e.printStackTrace();
throw new VisioException(e);
}
}
/**
* tells Visio to save the drawing
*
* @throws VisioException
*/
public void save() throws VisioException {
try {
ActiveXComponent document = new ActiveXComponent(getProperty(
"ActiveDocument").toDispatch());
document.invoke("Save");
} catch (Exception e) {
e.printStackTrace();
throw new VisioException(e);
}
}
/**
* terminates Visio
*/
public void quit() {
System.out.println("Received quit()");
// there can't be any open documents for this to work
// you'll get a visio error if you don't close them
ActiveXComponent document = new ActiveXComponent(getProperty(
"ActiveDocument").toDispatch());
document.invoke("Close");
invoke("Quit");
}
/**
* runs the Visio export command
*
* @param f
* @throws VisioException
*/
public void export(File f) throws VisioException {
try {
ActiveXComponent document = new ActiveXComponent(getProperty(
"ActivePage").toDispatch());
Variant[] args = new Variant[1];
args[0] = new Variant(f.getPath());
document.invoke("Export", args);
} catch (Exception e) {
throw new VisioException(e);
}
}
/**
* makes Visio visible so the user can watch
*
* @param b
* @throws VisioException
*/
public void setVisible(boolean b) throws VisioException {
try {
setProperty("Visible", new Variant(b));
} catch (Exception e) {
throw new VisioException(e);
}
}
}

View File

@@ -0,0 +1,180 @@
package com.jacob.samples.visio;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Created as part of sourceforge 1386454 to demonstrate returning values in
* event handlers
*
* @author miles@rowansoftware.net
*
* This singleton isolates the demo app from the Visio instance object so that
* you can't try and send messages to a dead Visio instance after quit() has
* been called. Direct consumption of VisioApp would mean you could quit but
* would still have a handle to the no longer connected application proxy
*
*/
public class VisioAppFacade {
private VisioApp app;
private static VisioAppFacade instance;
/** extension for image files */
public static final String IMAGE_EXT = ".jpg";
/** extension for visio files */
public static final String VISIO_EXT = ".vsd";
/** the buffer size when we want to read stuff in */
public static final int BUFFER_SIZE = 2048;
/**
* Wrapper around Visio
*
* @throws VisioException
*/
private VisioAppFacade() throws VisioException {
this.app = new VisioApp();
app.addEventListener(new VisioEventAdapter(app));
}
/**
* @return the singleton instance of Visio
* @throws VisioException
*/
public static VisioAppFacade getInstance() throws VisioException {
if (instance == null) {
instance = new VisioAppFacade();
}
return instance;
}
/**
* creates a preview in a temp file and returns the raw data.
*
* @param visioData
* @return raw preview data
* @throws VisioException
*/
public byte[] createPreview(byte[] visioData) throws VisioException {
byte[] preview;
File tmpFile;
try {
tmpFile = getTempVisioFile();
OutputStream out = new FileOutputStream(tmpFile);
out.write(visioData);
out.close();
} catch (IOException ioe) {
throw new VisioException(ioe);
}
preview = createPreview(tmpFile);
tmpFile.delete();
return preview;
}
/**
* reads a preview from a saved file
*
* @param visioFile
* @return raw preview data
* @throws VisioException
*/
public byte[] createPreview(File visioFile) throws VisioException {
try {
File imageFile;
imageFile = getTempImageFile();
app.open(visioFile);
app.export(imageFile);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
FileInputStream fin = new FileInputStream(imageFile);
copy(fin, bout);
fin.close();
imageFile.delete();
bout.close();
return bout.toByteArray();
} catch (IOException ioe) {
throw new VisioException(ioe);
}
}
private void copy(InputStream in, OutputStream out) throws IOException {
byte[] buff = new byte[BUFFER_SIZE];
int read;
do {
read = in.read(buff);
if (read > 0) {
out.write(buff, 0, read);
}
} while (read > 0);
}
/**
* creates a preview from an input stream
*
* @param in
* @return byte contents of the preview stream
* @throws VisioException
*/
public byte[] createPreview(InputStream in) throws VisioException {
byte[] preview;
// byte[] buff = new byte[2048];
// int read = 0;
OutputStream out;
File tmpFile;
try {
tmpFile = getTempVisioFile();
out = new FileOutputStream(tmpFile);
copy(in, out);
out.close();
} catch (IOException ioe) {
throw new VisioException(ioe);
}
preview = createPreview(tmpFile);
tmpFile.delete();
return preview;
}
/**
* opens the file in Visio and makes the editor visible
*
* @param f
* the reference to the Visio file to be opened
* @throws VisioException
*/
public void editDiagram(File f) throws VisioException {
app.open(f);
app.setVisible(true);
}
/**
* creates a temporary viso file
*
* @return created visio temporary file
* @throws IOException
*/
private File getTempVisioFile() throws IOException {
return File.createTempFile("java", VISIO_EXT);
}
/**
* creates a temporary image file and returns the File object
*
* @return the created image file object
* @throws IOException
*/
private File getTempImageFile() throws IOException {
return File.createTempFile("java", IMAGE_EXT);
}
/** exit visio */
public void quit() {
app.quit();
instance = null;
}
}

View File

@@ -0,0 +1,197 @@
package com.jacob.samples.visio;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.filechooser.FileFilter;
import com.jacob.com.ComThread;
/**
* Created as part of sourceforge 1386454 to demonstrate returning values in
* event handlers
*
* @author miles@rowansoftware.net
* <p>
* This file contains the main() that runs the demo
* <p>
* Look in the docs area at the Jacob usage document for command line
* options.
*/
public class VisioDemo extends JFrame implements ActionListener, WindowListener {
/**
* Totally dummy value to make Eclipse quit complaining
*/
private static final long serialVersionUID = 1L;
JButton chooseButton;
JButton openButton;
JPanel buttons;
ImageIcon theImage;
JLabel theLabel; // the icon on the page is actually this button's icon
File selectedFile;
/** everyone should get this through getVisio() */
private VisioAppFacade visioProxy = null;
// put this up here so it remembers where we were on the last choose
JFileChooser chooser = null;
public class VisioFileFilter extends FileFilter {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
} else {
return (f.getName().toUpperCase().endsWith(".VSD"));
}
}
public String getDescription() {
return "Visio Drawings";
}
}
public VisioDemo() {
super("Visio in Swing POC");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buttons = new JPanel();
getContentPane().setLayout(new BorderLayout());
chooseButton = new JButton("Choose file to display");
openButton = new JButton("Open file chosen file in Visio");
chooseButton.addActionListener(this);
openButton.addActionListener(this);
buttons.add(chooseButton);
buttons.add(openButton);
getContentPane().add(buttons, BorderLayout.SOUTH);
theLabel = new JLabel("");
getContentPane().add(theLabel, BorderLayout.CENTER);
addWindowListener(this);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setSize(640, 480);
this.setVisible(true);
}
public static void main(String args[]) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ComThread.InitSTA();
VisioDemo poc = new VisioDemo();
ComThread.Release();
if (poc == null) {
System.out.println("poc== null? That should never happen!");
}
}
});
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == chooseButton) {
pickFile();
} else if (e.getSource() == openButton) {
try {
openFile();
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
} else {
System.out.println("Awesome!");
}
}
private void pickFile() {
try {
chooser = new JFileChooser();
// comment this out if you want it to always go to myDocuments
chooser
.setCurrentDirectory(new File(System
.getProperty("user.dir")));
chooser.setFileFilter(new VisioFileFilter());
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
selectedFile = chooser.getSelectedFile();
showSelectedFilePreview();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* use this private method instead of initializing on boot up so that
* instance and all listeners are created in this thread (event thread)
* rather than root thread
*
* @return
*/
private VisioAppFacade getVisio() {
if (visioProxy == null) {
try {
visioProxy = VisioAppFacade.getInstance();
} catch (VisioException ve) {
System.out.println("ailed to openFile()");
ve.printStackTrace();
}
}
return visioProxy;
}
private void showSelectedFilePreview() throws VisioException {
if (selectedFile != null) {
byte[] image = getVisio().createPreview(selectedFile);
theImage = new ImageIcon(image);
theLabel.setIcon(theImage);
}
}
private void openFile() throws VisioException {
try {
getVisio().editDiagram(selectedFile);
showSelectedFilePreview();
} catch (VisioException ve) {
System.out.println("ailed to openFile()");
ve.printStackTrace();
}
}
public void windowActivated(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
System.out.println("WINDOW CLOSED");
if (visioProxy != null) {
visioProxy.quit();
}
}
public void windowClosing(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
System.out.println("Fooboo");
}
public void windowOpened(WindowEvent e) {
}
}

View File

@@ -0,0 +1,68 @@
package com.jacob.samples.visio;
import com.jacob.com.Variant;
/**
* Created as part of sourceforge 1386454 to demonstrate returning values in
* event handlers
*
* @author miles@rowansoftware.net
*
* You can subclass this class and only implement the methods you're interested
* in
*/
public class VisioEventAdapter implements VisioEventListener {
VisioApp app = null;
public VisioEventAdapter(VisioApp pApp) {
app = pApp;
System.out.println("Event listener constructed");
}
public void BeforeQuit(Variant[] args) {
}
public void DocumentChanged(Variant[] args) {
System.out.println("documentChanged()");
}
public void DocumentCloseCanceled(Variant[] args) {
}
public void DocumentCreated(Variant[] args) {
}
public void DocumentOpened(Variant[] args) {
System.out.println("DocumentOpened()");
}
public void DocumentSaved(Variant[] args) {
}
public void DocumentSavedAs(Variant[] args) {
}
public Variant QueryCancelDocumentClose(Variant[] args) {
System.out.println("QueryCancelDocumentClose()");
return new Variant(false);
}
/**
* we don't actually let it quit. We block it so that we don't have to
* relaunch when we look at a new document
*/
public Variant QueryCancelQuit(Variant[] args) {
// these may throw VisioException
System.out
.println("Saving document, hiding and telling visio not to quit");
try {
app.save();
app.setVisible(false);
} catch (VisioException ve) {
System.out.println("ailed to openFile()");
ve.printStackTrace();
}
return new Variant(true);
}
}

View File

@@ -0,0 +1,33 @@
package com.jacob.samples.visio;
import com.jacob.com.Variant;
/**
* Created as part of sourceforge 1386454 to demonstrate returning values in
* event handlers
*
* @author miles@rowansoftware.net
*
* There are many more Visio events available. See the Microsoft Office SDK
* documentation. To receive an event, add a method to this interface whose name
* matches the event name and has only one parameter, Variant[]. The JACOB
* library will use reflection to call that method when an event is received.
*/
public interface VisioEventListener {
public void BeforeQuit(Variant[] args);
public void DocumentChanged(Variant[] args);
public void DocumentCloseCanceled(Variant[] args);
public void DocumentCreated(Variant[] args);
public void DocumentOpened(Variant[] args);
public void DocumentSaved(Variant[] args);
public void DocumentSavedAs(Variant[] args);
public Variant QueryCancelQuit(Variant[] args);
}

View File

@@ -0,0 +1,25 @@
package com.jacob.samples.visio;
/**
* Created as part of sourceforge 1386454 to demonstrate returning values in
* event handlers
*
* @author miles@rowansoftware.net
*
* This extends runtime exception so that we can be sloppy and not put catch
* blocks everywhere
*/
public class VisioException extends Exception {
/**
* Totally dummy value to make Eclipse quit complaining
*/
private static final long serialVersionUID = 1L;
public VisioException(String msg) {
super(msg);
}
public VisioException(Throwable cause) {
super(cause);
}
}

Binary file not shown.