ITypeComp::Bind
(
szName,
lHashVal,
wFlags,
lplptinfo,
lpdesckind,
lpbindptr)
OLECHAR FAR* szName
unsigned long lHashVal
unsigned short wFlags
ITypeInfo FAR* FAR* lplptinfo
DESCKIND FAR* lpdesckind
BINDPTR FAR* lpbindptr
Maps a name to a member of a type, or binds global variables and functions
contained in a type library.
Parameters
szName
Name to be bound.
lHashVal
Hash value for the name computed by
LHashValOfNameSys.
wFlags
Flags word containing one or more of the INVOKE flags defined in the
INVOKEKIND enumeration. Specifies whether the name was referenced as a method or as a
property. When binding to a variable, specify the INVOKE_PROPERTYGET flag.
Specify 0 to bind to any type of member.
lplptinfo
If a FUNCDESC or VARDESC was returned, then
lplptinfo points to a pointer to the type description that contains the item to which
it is bound.
lpdesckind
Pointer to a DESCKIND enumerator that indicates whether the name bound to a
VARDESC, FUNCDESC, or TYPECOMP. Points to DESCKIND_NONE if there was no match.
lpbindptr
Upon return, contains a pointer to the bound-to VARDESC, FUNCDESC, or
ITypeComp.
Return Value
The SCODE obtained from the returned HRESULT is one of the following:
SCODE
| Meaning
|
S_OK
| Success.
|
E_OUTOFMEMORY
| Out of memory.
|
E_INVALIDARG
| One or more of the arguments is invalid.
|
TYPE_E_IOERROR
| The function could not read from the file.
|
TYPE_E_INVDATAREAD
| The function could not read from the file.
|
TYPE_E_UNSUPFORMAT
| The type library has an old format.
|
TYPE_E_INVALIDSTATE
| The type library could not be opened.
|
TYPE_E_AMBIGUOUSNAME
| More than one instance of this name occurs in the type library.
|
Comments
Used for binding to the variables and methods of a type, or for binding to the
global variables and methods in a type library. The returned DESCKIND pointer
lpdesckind indicates whether the name was bound to a VARDESC, a FUNCDESC, or an
ITypeComp instance. The returned
lpbindptr points to the VARDESC, FUNCDESC, or
ITypeComp.
If a data member or method is bound to, then
lplptinfo points to the type description that contains the method or data member.
If
Bind binds the name to a nested binding context, it returns a pointer to an
ITypeComp instance in lpbindptr and a NULL type description pointer in lplptinfo. For
example, if you pass the name of a type description for a module (TKIND_MODULE),
enumeration (TKIND_ENUM), or coclass (TKIND_COCLASS)
Bind returns the
ITypeComp instance of the type description for the module, enumeration, or coclass.
This feature supports languages like Visual Basic that allow references to the
members of a type description to be qualified by the name of the type description.
For example, a function in a module can be referenced by modulename
.functionname.
The members of TKIND_ENUM, TKIND_MODULE, and TKIND_COCLASS types marked as
Application objects can be directly bound to from
ITypeComp, without specifying the name of the module. The
ITypeComp of a coclass defers to the
ITypeComp of its default interface.
As with other methods of
ITypeComp,
ITypeInfo, and
ITypeLib, the calling code is responsible for releasing the returned object instances
or structures. If a VARDESC or FUNCDESC is returned, the caller is responsible
for deleting it via the returned type description and releasing the type
description instance itself; otherwise, if an
ITypeComp instance is returned, the caller must release it.
Special rules apply if you call a type library's
Bind method, passing it the name of a member of an Application object class (that
is, a class that has the TYPEFLAG_FAPPOBJECT flag set). In this case,
Bind returns DESCKIND_IMPLICITAPPOBJ in
lpdesckind, a VARDESC that describes the Application object in
lpbindptr, and the
ITypeInfo of the Application object class in
lplptinfo. To bind to the object, you must call
ITypeInfo::GetTypeComp to get the
ITypeComp of the Application object class, and then reinvoke its
Bind method with the name initially passed to the type library's
ITypeComp.
The caller should use the returned
ITypeInfo pointer (
lplptinfo) to get the address of the member.
Note that the
wflags parameter is the same as the
wflags parameter in
IDispatch::Invoke.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database