Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Provides access to COM object properties, methods, and events through early binding.
GETINTERFACE(oObject [, cIID | cInterface[, cTypelib | cProgID]])
Returns
COM Object Interface reference
Parameters
- oObject
Specifies the target COM object. - cIID
Specifies the GUID of the target interface of oObject. cIID can be an interface such as "IContextState" or it can be a GUID, such as "{94631BEC-EE81-479A-AE64-A6CFC37B4799}". If it's "IDispatch", then GetInterface() returns an IDispatch (late-bound) reference to the object. If cIID is not specified, then GetInterface() will return the early binding interface for the object. - cInterface
Specifies the interface name. - cTypelib
Specifies the name of the type library containing the oObject class. - cProgID
Specifies the name of the program to be used to lookup the type library.
Remarks
GetInterface( ) applies only to COM objects. If you use native Visual FoxPro objects, GetInterface( ) generates an error. GetInterface( ) returns an early-bound Object reference.
Example
The following code snippet is an example of a method you can use in your Visual FoxPro COM server to handle transactions in a COM+ Application. This sample requires that the COM server containing this code be added to a COM+ Application before it can be called by a client.
LOCAL oMTX, oContext, oContextState
LOCAL lTxnState, lGetTxnState, lDone, lGetDone
lGetDone = .F. && initialize setting
lGetTxnState = 0 && initialize setting
oMTX = CREATEOBJECT("MTXAS.APPSERVER.1")
oContext = oMTX.GetObjectContext()
oContextState = GetInterface(oContext,"IContextState")
* Handle activation setting (Doneness)
* Values: .T. - Deactivate, .F. - Leave activated
lDone = .T.
oContextState.SetDeactivateOnReturn(lDone)
oContextState.GetDeactivateOnReturn(@lGetDone)
* Handle transaction setting (Consistency)
* Values: 0 - commit, 1 - abort
lTxnState = 1
oContextState.SetMyTransactionVote(lTxnState)
oContextState.GetMyTransactionVote(@lGetTxnState)
See Also
CREATEOBJECTEX( ) | Early (vtable) and Late (IDispatch) Binding | GETOBJECT( ) | SYS(2333) - ActiveX Dual Interface Support | Viewing Type Library Information