com.moesol.bindings.platform_sdk.component_services
Class COM

java.lang.Object
  extended by com.moesol.bindings.platform_sdk.component_services.COM

public class COM
extends Object


Field Summary
static int CLSCTX_ALL
          See CoCreateInstance
static int CLSCTX_DISABLE_AAA
          See CoCreateInstance
static int CLSCTX_ENABLE_AAA
          See CoCreateInstance
static int CLSCTX_ENABLE_CODE_DOWNLOAD
          See CoCreateInstance
static int CLSCTX_FROM_DEFAULT_CONTEXT
          See CoCreateInstance
static int CLSCTX_INPROC
          See CoCreateInstance
static int CLSCTX_INPROC_HANDLER
          See CoCreateInstance
static int CLSCTX_INPROC_HANDLER16
          See CoCreateInstance
static int CLSCTX_INPROC_SERVER
          See CoCreateInstance
static int CLSCTX_INPROC_SERVER16
          See CoCreateInstance
static int CLSCTX_LOCAL
          See CoCreateInstance
static int CLSCTX_LOCAL_SERVER
          See CoCreateInstance
static int CLSCTX_NO_CODE_DOWNLOAD
          See CoCreateInstance
static int CLSCTX_NO_CUSTOM_MARSHAL
          See CoCreateInstance
static int CLSCTX_NO_FAILURE_LOG
          See CoCreateInstance
static int CLSCTX_REMOTE_SERVER
          See CoCreateInstance
static int CLSCTX_RESERVED1
          See CoCreateInstance, apparently CLSCTX_INPROC_SERVERX86 was deprecated
static int CLSCTX_RESERVED2
          See CoCreateInstance, apparently CLSCTX_INPROC_HANDLERX86 was deprecated
static int CLSCTX_RESERVED3
          See CoCreateInstance, apparently CLSCTX_ESERVER_HANDLER was deprecated
static int CLSCTX_RESERVED4
          See CoCreateInstance
static int CLSCTX_RESERVED5
          See CoCreateInstance
static int CLSCTX_SERVER
          See CoCreateInstance
static String ThreadingModel_Apartment
          See InprocServer32 in MSDN
static String ThreadingModel_Both
          See InprocServer32 in MSDN
static String ThreadingModel_Free
          See InprocServer32 in MSDN
static String ThreadingModel_Neutral
          See InprocServer32 in MSDN
 
Constructor Summary
COM()
           
 
Method Summary
static int addListener(IUnknown source, IUnknown listener, GUID diid)
          Adds a COM event listener to source.
static GUID CoCreateGuid()
           
static int CoCreateInstance(GUID rclsid, IUnknown pUnkOuter, int dwClsContext, Object[] out_iface)
          See CoCreateInstance
static void disableApartmentChecking(IUnknown unk)
          Turn off apartment thread checking for unk.
static GUID extractIID(IUnknown unk)
          Get the IID of the most derived interface that unk represents.
static void gc()
          Call System.gc in a loop for upto one second to release all COM interfaces.
static int getGenericSinkInstanceCount()
           
static int getUnreleasedCount()
          The unreleased count is the count of all IUnknown and subclasses that have native COM interfaces attached.
static int getVtableThunkCount()
           
static void Invoke(IDispatch callee, int dispIdMember, GUID riid, int lcid, short wFlags, Object[] dispParams, Object[] varResult)
           
static String lookupIID(GUID iid)
          Return the friendly name for the IID or the String version of the IID.
static int mapExceptionToHRESULT(Throwable t)
           
static int OleCreatePropertyFrame(HWND hwndOwner, int x, int y, String lpszCaption, IUnknown[] objects, GUID[] lpPageClsID, int lcid, int dwReserved, Object lpvReserved)
           
static int OleInitialize()
          See OleInitialize.
static void OleUninitialize()
          See OleUninitialize.
static void printObject(Object obj)
           
static void recordApartment(IUnknown unk)
          Turn on apartment thread checking for unk.
static void removeListener(IUnknown source, IUnknown listener, GUID diid)
          Removes a COM event listener from source.
static void wrapJavaWithNativeDispatch(IDispatch java_sink, Object[] out_iface)
          The method should probably have default access instead of public.
static void wrapJavaWithVtableInterface(ComObject java_sink, Object[] out_iface)
          Note that tlb2java should auto-wrap when a java interface is passed in and it is not vtable based! Also, with Reverse COM QueryInterface does the same thing as this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLSCTX_INPROC_SERVER

public static final int CLSCTX_INPROC_SERVER
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_INPROC_HANDLER

public static final int CLSCTX_INPROC_HANDLER
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_LOCAL_SERVER

public static final int CLSCTX_LOCAL_SERVER
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_INPROC_SERVER16

public static final int CLSCTX_INPROC_SERVER16
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_REMOTE_SERVER

public static final int CLSCTX_REMOTE_SERVER
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_INPROC_HANDLER16

public static final int CLSCTX_INPROC_HANDLER16
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_RESERVED1

public static final int CLSCTX_RESERVED1
See CoCreateInstance, apparently CLSCTX_INPROC_SERVERX86 was deprecated

See Also:
Constant Field Values

CLSCTX_RESERVED2

public static final int CLSCTX_RESERVED2
See CoCreateInstance, apparently CLSCTX_INPROC_HANDLERX86 was deprecated

See Also:
Constant Field Values

CLSCTX_RESERVED3

public static final int CLSCTX_RESERVED3
See CoCreateInstance, apparently CLSCTX_ESERVER_HANDLER was deprecated

See Also:
Constant Field Values

CLSCTX_RESERVED4

public static final int CLSCTX_RESERVED4
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_NO_CODE_DOWNLOAD

public static final int CLSCTX_NO_CODE_DOWNLOAD
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_RESERVED5

public static final int CLSCTX_RESERVED5
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_NO_CUSTOM_MARSHAL

public static final int CLSCTX_NO_CUSTOM_MARSHAL
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_ENABLE_CODE_DOWNLOAD

public static final int CLSCTX_ENABLE_CODE_DOWNLOAD
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_NO_FAILURE_LOG

public static final int CLSCTX_NO_FAILURE_LOG
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_DISABLE_AAA

public static final int CLSCTX_DISABLE_AAA
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_ENABLE_AAA

public static final int CLSCTX_ENABLE_AAA
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_FROM_DEFAULT_CONTEXT

public static final int CLSCTX_FROM_DEFAULT_CONTEXT
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_INPROC

public static final int CLSCTX_INPROC
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_ALL

public static final int CLSCTX_ALL
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_SERVER

public static final int CLSCTX_SERVER
See CoCreateInstance

See Also:
Constant Field Values

CLSCTX_LOCAL

public static final int CLSCTX_LOCAL
See CoCreateInstance

See Also:
Constant Field Values

ThreadingModel_Apartment

public static final String ThreadingModel_Apartment
See InprocServer32 in MSDN

See Also:
Constant Field Values

ThreadingModel_Both

public static final String ThreadingModel_Both
See InprocServer32 in MSDN

See Also:
Constant Field Values

ThreadingModel_Free

public static final String ThreadingModel_Free
See InprocServer32 in MSDN

See Also:
Constant Field Values

ThreadingModel_Neutral

public static final String ThreadingModel_Neutral
See InprocServer32 in MSDN

See Also:
Constant Field Values
Constructor Detail

COM

public COM()
Method Detail

addListener

public static int addListener(IUnknown source,
                              IUnknown listener,
                              GUID diid)
Adds a COM event listener to source. Internally, addListener uses the IConnectPointContainer of the source to find the IConnectionPoint and the add listener.

Parameters:
source -
listener -
diid -

removeListener

public static void removeListener(IUnknown source,
                                  IUnknown listener,
                                  GUID diid)
Removes a COM event listener from source.

Parameters:
source -
listener -
diid -

wrapJavaWithNativeDispatch

public static void wrapJavaWithNativeDispatch(IDispatch java_sink,
                                              Object[] out_iface)
The method should probably have default access instead of public. It is kept public for backward compatibility with older releases. This method will be marked deprecated with tlb2java automatically wraps java interfaces with native proxies.

Parameters:
java_sink -
out_iface -

wrapJavaWithVtableInterface

public static void wrapJavaWithVtableInterface(ComObject java_sink,
                                               Object[] out_iface)
Note that tlb2java should auto-wrap when a java interface is passed in and it is not vtable based! Also, with Reverse COM QueryInterface does the same thing as this method.


lookupIID

public static String lookupIID(GUID iid)
Return the friendly name for the IID or the String version of the IID.

Parameters:
iid -
Returns:

CoCreateInstance

public static int CoCreateInstance(GUID rclsid,
                                   IUnknown pUnkOuter,
                                   int dwClsContext,
                                   Object[] out_iface)
See CoCreateInstance

Parameters:
rclsid -
pUnkOuter -
dwClsContext -
out_iface -
Returns:
HRESULT

CoCreateGuid

public static GUID CoCreateGuid()

OleCreatePropertyFrame

public static int OleCreatePropertyFrame(HWND hwndOwner,
                                         int x,
                                         int y,
                                         String lpszCaption,
                                         IUnknown[] objects,
                                         GUID[] lpPageClsID,
                                         int lcid,
                                         int dwReserved,
                                         Object lpvReserved)

disableApartmentChecking

public static void disableApartmentChecking(IUnknown unk)
Turn off apartment thread checking for unk.

Parameters:
unk -

recordApartment

public static void recordApartment(IUnknown unk)
Turn on apartment thread checking for unk.

Parameters:
unk -

OleInitialize

public static int OleInitialize()
See OleInitialize. You do not need to call this method if you use an OleThread.

Returns:
HRESULT
See Also:
OleThread

OleUninitialize

public static void OleUninitialize()
See OleUninitialize. You do not need to call this method if you use an OleThread.

See Also:
OleThread

gc

public static void gc()
Call System.gc in a loop for upto one second to release all COM interfaces. Since System.gc may not always call finalize on all finalizable objects we loop for upto 30 seconds calling System.gc and Thread.yield. If the unreleased count goes to zero return immediately. Note that interfaces allocated on two different threads may cause the global count to be non-zero.


extractIID

public static GUID extractIID(IUnknown unk)
Get the IID of the most derived interface that unk represents. Used in the unit tests to confirm QI is working correctly.

Parameters:
unk -
Returns:
a GUID that is the IID of the most derived interface that unk represents.

getUnreleasedCount

public static int getUnreleasedCount()
The unreleased count is the count of all IUnknown and subclasses that have native COM interfaces attached. To free these native COM interfaces the IUnknown.Release must be called.

Returns:
Count of all COM interfaces that have not been released.

getGenericSinkInstanceCount

public static int getGenericSinkInstanceCount()
Returns:
the number of generic sinks that have not been released.

getVtableThunkCount

public static int getVtableThunkCount()
Returns:
the number of thunks that have not been relesed.

mapExceptionToHRESULT

public static int mapExceptionToHRESULT(Throwable t)
Parameters:
t -
Returns:
best HRESULT based on t.

Invoke

public static void Invoke(IDispatch callee,
                          int dispIdMember,
                          GUID riid,
                          int lcid,
                          short wFlags,
                          Object[] dispParams,
                          Object[] varResult)

printObject

public static void printObject(Object obj)


Copyright © 2004 Moebius Solutions, Inc. All Rights Reserved.