IGlobalAPI_KC Interface
- LockInitialisationContext
- LaunchExplorer
- GetReferenceCount
- AddRefUnsafe
- ReleaseUnsafe
Implements collection of global methods of DG Kernel software, independent of any
particular control instance.
When a DG Kernel window was already created query this interface from
IView or IModel,
otherwise use the method below.
IGlobalAPI_KC is implemented (can be queried from) by KcApiComProxy object which can be
created via COM, independently of any controls or views, including command line
applications. KcApiComProxy object can
be instantiated in COM-enabled development environments by using either its Class ID or Program ID (see below).
In .NET environment DIObjGenerator can be created using standard new
operator as (C# example):
KernCADnet.KcApiComProxyClass kcApi = new KernCADnet.KcApiComProxyClass();
IGlobalAPI_KC iApi = (IGlobalAPI_KC)kcApi;
Actual name of the wrapper class might be different in different versions of the
development environment. Refer to Object Browser in the project after adding a
reference to the KernelCADnet component (See Patch Tutorial).
In C++ the KcApiComProxy can be instantiated by using its Class ID and call
to CoGetClassObject() COM function.
In native Visual Basic an instance of the class can be created using the Program ID
and CreateObject() API as follows:
Dim iGlobApi
As IGlobalAPI_KC
Set
iGlobApi
= CreateObject("KERNELCAD.KCAPI.1")
KcApiComProxy implements a single IGlobalAPI_KC interface,
which can be obtained via call to CreateInstance() COM API in C/C++ or
a cast in other languages.
Class IDs
.NET:
Class ID:
// {1BAD07C5-A93E-4b10-8AE7-B3215A5F6917}
static const GUID CLSID_KcApiComProxy =
{ 0x1bad07c5, 0xa93e, 0x4b10, { 0x8a, 0xe7, 0xb3, 0x21, 0x5a, 0x5f, 0x69, 0x17 } };
Program ID:
KERNELCAD_NET.KCAPI.1
Native:
Class ID:
// {DA3EF301-E066-42EE-BCF4-4EAFCB41DCB5}
static const GUID CLSID_KcApiComProxy =
{ 0xda3ef301, 0xe066, 0x42ee, { 0xbc, 0xf4, 0x4e, 0xaf, 0xcb, 0x41, 0xdc, 0xb5 } };
Program ID:
KERNELCAD.KCAPI.1
See also
IControlInitialisationContext_KC
HRESULT LockInitialisationContext(IControlInitialisationContext_KC** context)
Parameters
context-[out] the returned context
-
- Remarks:
The method acquires exclusive access to the
Component Initialisation Context.
Call context.ReleaseContext()
when it is no longer needed to allow access to it by other
threads. If the context cannot be accessed in 5 seconds the method returns null
HRESULT LaunchExplorer(IModel* model,
IView* view)
Opens Model Explorer window for the model
HRESULT GetReferenceCount(IUnknown* anInterface, [out, retval] int* count)
Returns the current reference count for the object, which implements interface anInterface. See lso Memory Management
HRESULT AddRefUnsafe(IUnknown* anInterface, [out, retval] int* count)
Increments the reference count for the object, which implements interface anInterface and returns the incremented value. Warning: This method should only
be used in exceptional situations as a temporary workaround. See lso Memory Management
HRESULT ReleaseUnsafe(IUnknown* anInterface, [out, retval] int* count)
Decrements the reference count for the, object which implements interface anInterface and returns the new value.
When the retuned value is 0 the object has been deleted and the interface must not be used. Warning: This method should only
be used in exceptional situations as a temporary workaround. See lso Memory Management
|