public interface Ole32 extends StdCallLibrary
StdCallLibrary.StdCallCallback
Library.Handler
Modifier and Type | Field and Description |
---|---|
static int |
COINIT_APARTMENTTHREADED |
static int |
COINIT_DISABLE_OLE1DDE |
static int |
COINIT_MULTITHREADED |
static int |
COINIT_SPEED_OVER_MEMORY |
static Ole32 |
INSTANCE
The instance.
|
FUNCTION_MAPPER, STDCALL_CONVENTION
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
Modifier and Type | Method and Description |
---|---|
WinNT.HRESULT |
CLSIDFromProgID(java.lang.String lpszProgID,
Guid.CLSID.ByReference lpclsid)
Looks up a CLSID in the registry, given a ProgID.
|
WinNT.HRESULT |
CLSIDFromString(java.lang.String lpsz,
Guid.CLSID.ByReference pclsid)
Converts a string generated by the StringFromCLSID function back into the
original CLSID.
|
WinNT.HRESULT |
CLSIDFromString(WString lpsz,
Guid.CLSID.ByReference pclsid)
Deprecated.
use the String version
|
WinNT.HRESULT |
CoCreateGuid(Guid.GUID.ByReference pguid)
Deprecated.
|
WinNT.HRESULT |
CoCreateGuid(Guid.GUID pguid)
Creates a GUID, a unique 128-bit integer used for CLSIDs and interface
identifiers.
|
WinNT.HRESULT |
CoCreateInstance(Guid.GUID rclsid,
Pointer pUnkOuter,
int dwClsContext,
Guid.GUID riid,
PointerByReference ppv)
Creates a single uninitialized object of the class associated with a
specified CLSID.
|
WinNT.HRESULT |
CoGetMalloc(WinDef.DWORD dwMemContext,
PointerByReference ppMalloc)
Retrieves a pointer to the default OLE task memory allocator.
|
WinNT.HRESULT |
CoInitialize(WinDef.LPVOID pvReserved)
Initializes the COM library on the current thread and identifies the
concurrency model as single-thread apartment (STA).
|
WinNT.HRESULT |
CoInitializeEx(Pointer reserved,
int dwCoInit)
Initializes the COM library for use by the calling thread, sets the
thread's concurrency model, and creates a new apartment for the thread if
one is required.
|
boolean |
CoIsHandlerConnected(Pointer pUnk)
Determines whether a remote object is connected to the corresponding in-process object.
|
Pointer |
CoTaskMemAlloc(long cb)
Allocates a block of task memory in the same way that IMalloc::Alloc does.
|
void |
CoTaskMemFree(Pointer pv)
Frees a block of task memory previously allocated through a call to the
CoTaskMemAlloc(long) or
CoTaskMemRealloc(com.sun.jna.Pointer, long) function. |
Pointer |
CoTaskMemRealloc(Pointer pv,
long cb)
Changes the size of a previously allocated block of task memory.
|
void |
CoUninitialize()
Closes the COM library on the current thread, unloads all DLLs loaded by
the thread, frees any other resources that the thread maintains, and
forces all RPC connections on the thread to close.
|
WinNT.HRESULT |
CreateBindCtx(WinDef.DWORD reserved,
PointerByReference ppbc)
Returns a pointer to an implementation of IBindCtx (a bind context object).
|
WinNT.HRESULT |
GetRunningObjectTable(WinDef.DWORD reserved,
PointerByReference pprot)
Returns a pointer to the IRunningObjectTable interface on the local running object table (ROT).
|
WinNT.HRESULT |
IIDFromString(java.lang.String lpsz,
Guid.GUID lpiid)
Converts a string generated by the StringFromIID function back into the
original interface identifier (IID).
|
WinNT.HRESULT |
OleFlushClipboard()
Carries out the clipboard shutdown sequence.
|
WinNT.HRESULT |
OleInitialize(Pointer pvReserved)
Initializes the COM library on the current apartment, identifies the
concurrency model as single-thread apartment (STA), and enables
additional functionality described in the Remarks section below.
|
WinNT.HRESULT |
OleRun(Pointer pUnknown)
Puts an OLE compound document object into the running state.
|
void |
OleUninitialize()
Closes the COM library on the apartment, releases any class factories,
other COM objects, or servers held by the apartment, disables RPC on the
apartment, and frees any resources the apartment maintains.
|
int |
StringFromGUID2(Guid.GUID rguid,
char[] lpsz,
int cchMax)
Converts a globally unique identifier (GUID) into a string of printable
characters.
|
static final Ole32 INSTANCE
static final int COINIT_APARTMENTTHREADED
static final int COINIT_MULTITHREADED
static final int COINIT_DISABLE_OLE1DDE
static final int COINIT_SPEED_OVER_MEMORY
WinNT.HRESULT CoCreateGuid(Guid.GUID pguid)
pguid
- A pointer to the requested GUID.WinNT.HRESULT CoCreateGuid(Guid.GUID.ByReference pguid)
CoCreateGuid(Guid.GUID)
.pguid
- GUID referenceint StringFromGUID2(Guid.GUID rguid, char[] lpsz, int cchMax)
rguid
- The GUID to be converted.lpsz
- A pointer to a caller-allocated string variable to receive the
resulting string.cchMax
- The number of characters available in the lpsz buffer.WinNT.HRESULT IIDFromString(java.lang.String lpsz, Guid.GUID lpiid)
lpsz
- A pointer to the string representation of the IID.lpiid
- A pointer to the requested IID on return.WinNT.HRESULT CoInitialize(WinDef.LPVOID pvReserved)
pvReserved
- the pv reservedWinNT.HRESULT CoInitializeEx(Pointer reserved, int dwCoInit)
reserved
- This parameter is reserved and must be NULL.dwCoInit
- The concurrency model and initialization options for the
thread. Values for this parameter are taken from the COINIT
enumeration. Any combination of values from COINIT can be
used, except that the COINIT_APARTMENTTHREADED
and
COINIT_MULTITHREADED
flags cannot both be set. The
default (and only sane choice) is
COINIT_MULTITHREADED
.void CoUninitialize()
WinNT.HRESULT CoCreateInstance(Guid.GUID rclsid, Pointer pUnkOuter, int dwClsContext, Guid.GUID riid, PointerByReference ppv)
rclsid
- The CLSID associated with the data and code that will be used
to create the object.pUnkOuter
- If NULL, indicates that the object is not being created as
part of an aggregate. If non-NULL, pointer to the aggregate
object's IUnknown interface (the controlling IUnknown).dwClsContext
- Context in which the code that manages the newly created
object will run. The values are taken from the enumeration
CLSCTX defined in WTypes.riid
- A reference to the identifier of the interface to be used to
communicate with the object.ppv
- Address of pointer variable that receives the interface
pointer requested in riid. Upon successful return, *ppv
contains the requested interface pointer. Upon failure, *ppv
contains NULL.WinNT.HRESULT CLSIDFromProgID(java.lang.String lpszProgID, Guid.CLSID.ByReference lpclsid)
lpszProgID
- [in] A pointer to the ProgID whose CLSID is requested.lpclsid
- [out] Receives a pointer to the retrieved CLSID on return.WinNT.HRESULT CLSIDFromString(java.lang.String lpsz, Guid.CLSID.ByReference pclsid)
lpsz
- [in] The string representation of the CLSID.pclsid
- [out] A pointer to the CLSID.WinNT.HRESULT CLSIDFromString(WString lpsz, Guid.CLSID.ByReference pclsid)
Pointer CoTaskMemAlloc(long cb)
The initial contents of the returned memory block are undefined - there is no guarantee that the block has been initialized. The allocated block may be larger than cb bytes because of the space required for alignment and for maintenance information.
If cb is 0, CoTaskMemAlloc allocates a zero-length item and returns a valid pointer to that item. If there is insufficient memory available, CoTaskMemAlloc returns NULL. Applications should always check the return value from this function, even when requesting small amounts of memory, because there is no guarantee that the memory will be allocated.cb
- The size of the memory block to be allocated, in bytes.Pointer CoTaskMemRealloc(Pointer pv, long cb)
The pv parameter points to the beginning of the memory block. If pv is NULL, CoTaskMemRealloc allocates a new memory block in the same way as the CoTaskMemAlloc function. If pv is not NULL, it should be a pointer returned by a prior call to CoTaskMemAlloc.
The cb parameter specifies the size of the new block. The contents of the block are unchanged up to the shorter of the new and old sizes, although the new block can be in a different location. Because the new block can be in a different memory location, the pointer returned by CoTaskMemRealloc is not guaranteed to be the pointer passed through the pv argument. If pv is not NULL and cb is 0, then the memory pointed to by pv is freed.
CoTaskMemRealloc returns a void pointer to the reallocated (and possibly moved) memory block. The return value is NULL if the size is 0 and the buffer argument is not NULL, or if there is not enough memory available to expand the block to the specified size. In the first case, the original block is freed; in the second case, the original block is unchanged. The storage space pointed to by the return value is guaranteed to be suitably aligned for storage of any type of object. To get a pointer to a type other than void, use a type cast on the return value.pv
- A pointer to the memory block to be reallocated. This parameter can be NULL.cb
- The size of the memory block to be reallocated, in bytes. This parameter can be 0.void CoTaskMemFree(Pointer pv)
CoTaskMemAlloc(long)
or
CoTaskMemRealloc(com.sun.jna.Pointer, long)
function. The function uses the default OLE allocator. The number of bytes
freed equals the number of bytes that were originally allocated or reallocated. After the call, the memory block
pointed to by pv is invalid and can no longer be used.pv
- A pointer to the memory block to be freed. If this parameter is NULL, the function has no effect.WinNT.HRESULT CoGetMalloc(WinDef.DWORD dwMemContext, PointerByReference ppMalloc)
HRESULT CoGetMalloc(
[In] DWORD dwMemContext,
[Out] LPMALLOC *ppMalloc
);
dwMemContext
- contextppMalloc
- returned pointerWinNT.HRESULT GetRunningObjectTable(WinDef.DWORD reserved, PointerByReference pprot)
HRESULT GetRunningObjectTable(
[In] DWORD reserved,
[Out] LPRUNNINGOBJECTTABLE *pprot
);
reserved
- unusedpprot
- returned pointerWinNT.HRESULT CreateBindCtx(WinDef.DWORD reserved, PointerByReference ppbc)
HRESULT CreateBindCtx(
[In] DWORD reserved,
[Out] LPBC *ppbc
);
reserved
- unusedppbc
- returned pointerboolean CoIsHandlerConnected(Pointer pUnk)
BOOL CoIsHandlerConnected(
[In] LPUNKNOWN pUnk
);
pUnk
- objectWinNT.HRESULT OleInitialize(Pointer pvReserved)
pvReserved
- Reserved; must be null.S_OK
if the COM library and additional functionality were
initialized successfully on this apartment.
S_FALSE
if the COM library is already initialized on this apartment.
OLE_E_WRONGCOMPOBJ
if the versions of COMPOBJ.DLL and OLE2.DLL on
your machine are incompatible with each other.
RPC_E_CHANGED_MODE
if a previous call to CoInitializeEx specified
the concurrency model for this apartment as
multithread apartment (MTA). If running
Windows 2000, this could also mean that a
change from neutral threaded apartment to
single threaded apartment occurred.
void OleUninitialize()
OleInitialize(com.sun.jna.Pointer)
. OleUninitialize calls the CoUninitialize function
internally to shut down the OLE Component Object(COM) Library.
If the COM library was initialized on the apartment with a call to
CoInitialize or CoInitializeEx, it must be closed with a call to
CoUninitialize.
The OleInitialize(com.sun.jna.Pointer)
and OleUninitialize calls must be balanced —
if there are multiple calls to the OleInitialize(com.sun.jna.Pointer)
function, there
must be the same number of calls to OleUninitialize: Only the
OleUninitialize call corresponding to the OleInitialize(com.sun.jna.Pointer)
call
that actually initialized the library can close it.WinNT.HRESULT OleFlushClipboard()
S_OK
on success.
CLIPBRD_E_CANT_OPEN
The Windows OpenClipboard function used
within OleFlushClipboard failed.
CLIPBRD_E_CANT_CLOSE
The Windows CloseClipboard function used
within OleFlushClipboard failed.
Remarks
OleFlushClipboard renders the data from a data object onto the clipboard and releases the IDataObject pointer to the data object. While the application that put the data object on the clipboard is running, the clipboard holds only a pointer to the data object, thus saving memory. If you are writing an application that acts as the source of a clipboard operation, you can call the OleFlushClipboard function when your application is closed, such as when the user exits from your application. Calling OleFlushClipboard enables pasting and paste-linking of OLE objects after application shutdown. Before calling OleFlushClipboard, you can easily determine if your data is still on the clipboard with a call to the OleIsCurrentClipboard function. OleFlushClipboard leaves all formats offered by the data transfer object, including the OLE 1 compatibility formats, on the clipboard so they are available after application shutdown. In addition to OLE 1 compatibility formats, these include all formats offered on a global handle medium (all except for TYMED_FILE) and formatted with a null target device. For example, if a data-source application offers a particular clipboard format (say cfFOO) on an IStorage object, and calls the OleFlushClipboard function, the storage object is copied into memory and the hglobal memory handle is put on the clipboard. To retrieve the information on the clipboard, you can call the OleGetClipboard function from another application, which creates a default data object, and the hglobal from the clipboard again becomes a storage object. Furthermore, the FORMATETC enumerator and the IDataObject::QueryGetData method would all correctly indicate that the original clipboard format (cfFOO) is again available on a TYMED_ISTORAGE. To empty the clipboard, call the OleSetClipboard function specifying a null value for its parameter. The application should call this when it closes if there is no need to leave data on the clipboard after shutdown, or if data will be placed on the clipboard using the standard Windows clipboard functions.
WinNT.HRESULT OleRun(Pointer pUnknown)
pUnknown
- [in] Pointer to the IUnknown
interface
on the object, with which it will query for a pointer to
the IRunnableObject interface, and then call its Run method.
OLE_E_CLASSDIFF
The source of an
OLE link has been converted to a different class.
Remarks
The OleRun function puts an object in the running state. The implementation of OleRun was changed in OLE 2.01 to coincide with the publication of the IRunnableObject interface. You can use OleRun and IRunnableObject::Run interchangeably. OleRun queries the object for a pointer to IRunnableObject. If successful, the function returns the results of calling the IRunnableObject::Run method.
For more information on using this function, see IRunnableObject::Run.