170
❘
CHAPTER 9
InteractIng wIth cOM Objects
➤➤
/machine:
MachineType
: Creates an assembly for the specified machine type. The valid
inputs for this command line switch are:
X86
➤
➤
X64
➤
➤
Itanium
➤
➤
Agnostic
➤
➤
➤
➤
/transform:
TransformName
: Performs the specified transformations on the assembly. You
may use any of these values as a transformation.
➤
➤
SerializableValueClasses: Forces TLbImp to mark all of the classes as serializable.
➤
➤
DispRet: Applies the
[out, retval]
attribute to methods that have a dispatch-only
interface.
➤
➤
/strictref
: Forces TLbImp to use only the assemblies that you specify using the
/reference
command line switch, along with PIAs, to produce the output assembly,
even if the source file contains other references. The output assembly might not work
properly when you use this option.
➤
➤
/strictref:nopia
: Forces TLbImp to use only the assemblies that you specify using the
/reference
command line switch to produce the output assembly, even if the source file
contains other references. This command line switch ignores PIAs. The output assembly
might not work properly when you use this option.
➤
➤
/VariantBoolFieldToBool
: Converts all
VARIANT_BOOL
fields in structures to
bool
.
/?
➤
➤
or
/help
: Displays a help message containing a list of command line options for the
version of TLbImp that you’re using.
understanding the ActiveX Import utility
The example in this chapter relies on the ActiveX Import (AxImp) utility because it produces the
files you need to create a control (with a visual interface) rather than a component. When you use
this utility, you obtain two files as output. The first contains the same information you receive when
using the TLbImp utility. The second, the one with the Ax prefix, contains the code for a control.
Before you can use AxImp, you need to know a bit more about it. Here’s the command line syntax
for the tool:
AxImp OcxName [Options]
The
OcxName
argument is simply the filename of the COM component that you want to use to
create a control version of an interop assembly. A COM component can have a number of file
extensions, but the most common extensions are
.DLL
,
.EXE
, and
.OCX
. It’s uncommon for an
OLE Control eXtension (OCX), a COM component with a visual interface, to have a
.EXE
file
extension.
548592c09.indd 170
2/24/10 12:48:18 PM
www.finebook.ir
Do'stlaringiz bilan baham: |