description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: IAtlMemMgr Class |
IAtlMemMgr Class |
11/04/2016 |
|
|
18b2c569-25fe-4464-bdb6-3b1abef7154a |
This class represents the interface to a memory manager.
__interface __declspec(uuid("654F7EF5-CFDF-4df9-A450-6C6A13C622C0")) IAtlMemMgr
Name | Description |
---|---|
Allocate | Call this method to allocate a block of memory. |
Free | Call this method to free a block of memory. |
GetSize | Call this method to retrieve the size of an allocated memory block. |
Reallocate | Call this method to reallocate a block of memory. |
This interface is implemented by CComHeap, CCRTHeap, CLocalHeap, CGlobalHeap, or CWin32Heap.
Note
The local and global heap functions are slower than other memory management functions, and do not provide as many features. Therefore, new applications should use the heap functions. These are available in the CWin32Heap class.
[!code-cppNVC_ATL_Utilities#94]
Header: atlmem.h
Call this method to allocate a block of memory.
void* Allocate(size_t nBytes) throw();
nBytes
The requested number of bytes in the new memory block.
Returns a pointer to the start of the newly allocated memory block.
Call IAtlMemMgr::Free or IAtlMemMgr::Reallocate to free the memory allocated by this method.
For an example, see the IAtlMemMgr Overview.
Call this method to free a block of memory.
void Free(void* p) throw();
p
Pointer to memory previously allocated by this memory manager.
Use this method to free memory obtained by IAtlMemMgr::Allocate or IAtlMemMgr::Reallocate.
For an example, see the IAtlMemMgr Overview.
Call this method to retrieve the size of an allocated memory block.
size_t GetSize(void* p) throw();
p
Pointer to memory previously allocated by this memory manager.
Returns the size of the memory block in bytes.
For an example, see the IAtlMemMgr Overview.
Call this method to reallocate memory allocated by this memory manager.
void* Reallocate(void* p, size_t nBytes) throw();
p
Pointer to memory previously allocated by this memory manager.
nBytes
The requested number of bytes in the new memory block.
Returns a pointer to the start of the newly allocated memory block.
Call IAtlMemMgr::Free or IAtlMemMgr::Reallocate to free the memory allocated by this method.
Conceptually this method frees the existing memory and allocates a new memory block. In reality, the existing memory may be extended or otherwise reused.
For an example, see the IAtlMemMgr Overview.
The AllowContextMenu
property specifies whether the hosted control is allowed to display its own context menu.
STDMETHOD(get_AllowContextMenu)(VARIANT_BOOL* pbAllowContextMenu);
pbAllowContextMenu
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
The AllowShowUI
property specifies whether the hosted control is allowed to display its own user interface.
STDMETHOD(get_AllowShowUI)(VARIANT_BOOL* pbAllowShowUI);
pbAllowShowUI
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_FALSE as the default value of this property.
The AllowWindowlessActivation
property specifies whether the container will allow windowless activation.
STDMETHOD(get_AllowWindowlessActivation)(VARIANT_BOOL* pbAllowWindowless);
pbAllowWindowless
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
The BackColor
property specifies the ambient background color of the container.
STDMETHOD(get_BackColor)(OLE_COLOR* pclrBackground);
pclrBackground
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses COLOR_BTNFACE or COLOR_WINDOW as the default value of this property (depending on whether the parent of the host window is a dialog or not).
DisplayAsDefault
is an ambient property that allows a control to find out if it is the default control.
STDMETHOD(get_DisplayAsDefault)(VARIANT_BOOL* pbDisplayAsDefault);
pbDisplayAsDefault
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_FALSE as the default value of this property.
The DocHostDoubleClickFlags
property specifies the operation that should take place in response to a double-click.
STDMETHOD(get_DocHostDoubleClickFlags)(DWORD* pdwDocHostDoubleClickFlags);
pdwDocHostDoubleClickFlags
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses DOCHOSTUIDBLCLK_DEFAULT as the default value of this property.
The DocHostFlags
property specifies the user interface capabilities of the host object.
STDMETHOD(get_DocHostFlags)(DWORD* pdwDocHostFlags);
pdwDocHostFlags
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses DOCHOSTUIFLAG_NO3DBORDER as the default value of this property.
The Font
property specifies the ambient font of the container.
STDMETHOD(get_Font)(IFontDisp** pFont);
pFont
[out] The address of an IFontDisp
interface pointer used to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses the default GUI font or the system font as the default value of this property.
The ForeColor
property specifies the ambient foreground color of the container.
STDMETHOD(get_ForeColor)(OLE_COLOR* pclrForeground);
pclrForeground
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses the system window text color as the default value of this property.
The LocaleID
property specifies the ambient locale ID of the container.
STDMETHOD(get_LocaleID)(LCID* plcidLocaleID);
plcidLocaleID
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses the user's default locale as the default value of this property.
With this method you can discover the Ambient LocalID, that is, the LocaleID of the program your control is being used in. Once you know the LocaleID, you can call code to load locale-specific captions, error message text, and so forth from a resource file or satellite DLL.
The MessageReflect
ambient property specifies whether the container will reflect messages to the hosted control.
STDMETHOD(get_MessageReflect)(VARIANT_BOOL* pbMessageReflect);
pbMessageReflect
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
The OptionKeyPath
property specifies the registry key path to user settings.
STDMETHOD(get_OptionKeyPath)(BSTR* pbstrOptionKeyPath);
pbstrOptionKeyPath
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ShowGrabHandles
ambient property allows the control to find out if it should draw itself with grab handles.
STDMETHOD(get_ShowGrabHandles)(VARIANT_BOOL* pbShowGrabHandles);
pbShowGrabHandles
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation always returns VARIANT_FALSE as the value of this property.
The ShowHatching
ambient property allows the control to find out if it should draw itself hatched.
STDMETHOD(get_ShowHatching)(VARIANT_BOOL* pbShowHatching);
pbShowHatching
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation always returns VARIANT_FALSE as the value of this property.
The UserMode
property specifies the ambient user mode of the container.
STDMETHOD(get_UserMode)(VARIANT_BOOL* pbUserMode);
pbUserMode
[out] The address of a variable to receive the current value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
The AllowContextMenu
property specifies whether the hosted control is allowed to display its own context menu.
STDMETHOD(put_AllowContextMenu)(VARIANT_BOOL bAllowContextMenu);
bAllowContextMenu
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
The AllowShowUI
property specifies whether the hosted control is allowed to display its own user interface.
STDMETHOD(put_AllowShowUI)(VARIANT_BOOL bAllowShowUI);
bAllowShowUI
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_FALSE as the default value of this property.
The AllowWindowlessActivation
property specifies whether the container will allow windowless activation.
STDMETHOD(put_AllowWindowlessActivation)(VARIANT_BOOL bAllowWindowless);
bAllowWindowless
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
The BackColor
property specifies the ambient background color of the container.
STDMETHOD(put_BackColor)(OLE_COLOR clrBackground);
clrBackground
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses COLOR_BTNFACE or COLOR_WINDOW as the default value of this property (depending on whether the parent of the host window is a dialog or not).
DisplayAsDefault
is an ambient property that allows a control to find out if it is the default control.
STDMETHOD(put_DisplayAsDefault)(VARIANT_BOOL bDisplayAsDefault);
bDisplayAsDefault
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_FALSE as the default value of this property.
The DocHostDoubleClickFlags
property specifies the operation that should take place in response to a double-click.
STDMETHOD(put_DocHostDoubleClickFlags)(DWORD dwDocHostDoubleClickFlags);
dwDocHostDoubleClickFlags
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses DOCHOSTUIDBLCLK_DEFAULT as the default value of this property.
The DocHostFlags
property specifies the user interface capabilities of the host object.
STDMETHOD(put_DocHostFlags)(DWORD dwDocHostFlags);
dwDocHostFlags
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses DOCHOSTUIFLAG_NO3DBORDER as the default value of this property.
The Font
property specifies the ambient font of the container.
STDMETHOD(put_Font)(IFontDisp* pFont);
pFont
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses the default GUI font or the system font as the default value of this property.
The ForeColor
property specifies the ambient foreground color of the container.
STDMETHOD(put_ForeColor)(OLE_COLOR clrForeground);
clrForeground
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses the system window text color as the default value of this property.
The LocaleID
property specifies the ambient locale ID of the container.
STDMETHOD(put_LocaleID)(LCID lcidLocaleID);
lcidLocaleID
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses the user's default locale as the default value of this property.
The MessageReflect
ambient property specifies whether the container will reflect messages to the hosted control.
STDMETHOD(put_MessageReflect)(VARIANT_BOOL bMessageReflect);
bMessageReflect
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
The OptionKeyPath
property specifies the registry key path to user settings.
STDMETHOD(put_OptionKeyPath)(BSTR bstrOptionKeyPath);
bstrOptionKeyPath
[in] The new value of this property.
A standard HRESULT value.
The UserMode
property specifies the ambient user mode of the container.
STDMETHOD(put_UserMode)(VARIANT_BOOL bUserMode);
bUserMode
[in] The new value of this property.
A standard HRESULT value.
The ATL host object implementation uses VARIANT_TRUE as the default value of this property.
This method is called to supplement the default ambient property interface with a user-defined interface.
virtual HRESULT STDMETHODCALLTYPE SetAmbientDispatch(IDispatch* pDispatch) = 0;
pDispatch
Pointer to the new interface.
Returns S_OK on success, or an error HRESULT on failure.
When SetAmbientDispatch
is called with a pointer to a new interface, this new interface will be used to invoke any properties or methods asked for by the hosted control — if those properties are not already provided by IAxWinAmbientDispatch.
Attaches an existing (and previously initialized) control to the host object using the window identified by hWnd.
STDMETHOD(AttachControl)(IUnknown* pUnkControl, HWND hWnd);
pUnkControl
[in] A pointer to the IUnknown
interface of the control to be attached to the host object.
hWnd
[in] A handle to the window to be used for hosting.
A standard HRESULT value.
Creates a control, initializes it, and hosts it in the window identified by hWnd.
STDMETHOD(CreateControl)(
LPCOLESTR lpTricsData,
HWND hWnd,
IStream* pStream);
lpTricsData
[in] A string identifying the control to create. Can be a CLSID (must include the braces), ProgID, URL, or raw HTML (prefixed by MSHTML:).
hWnd
[in] A handle to the window to be used for hosting.
pStream
[in] An interface pointer for a stream containing initialization data for the control. Can be NULL.
A standard HRESULT value.
This window will be subclassed by the host object exposing this interface so that messages can be reflected to the control and other container features will work.
Calling this method is equivalent to calling IAxWinHostWindow::CreateControlEx.
To create a licensed ActiveX control, see IAxWinHostWindowLic::CreateControlLic.
Creates an ActiveX control, initializes it, and hosts it in the specified window, similar to IAxWinHostWindow::CreateControl.
STDMETHOD(CreateControlEx)(
LPCOLESTR lpszTricsData,
HWND hWnd,
IStream* pStream,
IUnknown** ppUnk,
REFIID riidAdvise,
IUnknown* punkAdvise);
lpTricsData
[in] A string identifying the control to create. Can be a CLSID (must include the braces), ProgID, URL, or raw HTML (prefixed with MSHTML:).
hWnd
[in] A handle to the window to be used for hosting.
pStream
[in] An interface pointer for a stream containing initialization data for the control. Can be NULL.
ppUnk
[out] The address of a pointer that will receive the IUnknown
interface of the created control. Can be NULL.
riidAdvise
[in] The interface identifier of an outgoing interface on the contained object. Can be IID_NULL.
punkAdvise
[in] A pointer to the IUnknown
interface of the sink object to be connected to the connection point on the contained object specified by iidSink
.
A standard HRESULT value.
Unlike the CreateControl
method, CreateControlEx
also allows you to receive an interface pointer to the newly created control and set up an event sink to receive events fired by the control.
To create a licensed ActiveX control, see IAxWinHostWindowLic::CreateControlLicEx.
Returns the specified interface pointer provided by the hosted control.
STDMETHOD(QueryControl)(REFIID riid, void** ppvObject);
riid
[in] The ID of an interface on the control being requested.
ppvObject
[out] The address of a pointer that will receive the specified interface of the created control.
A standard HRESULT value.
Sets the external dispinterface, which is available to contained controls through the IDocHostUIHandlerDispatch::GetExternal method.
STDMETHOD(SetExternalDispatch)(IDispatch* pDisp);
pDisp
[in] A pointer to an IDispatch
interface.
A standard HRESULT value.
Call this function to set the external IDocHostUIHandlerDispatch interface for the CAxWindow
object.
STDMETHOD(SetExternalUIHandler)(IDocHostUIHandlerDispatch* pDisp);
pDisp
[in] A pointer to an IDocHostUIHandlerDispatch
interface.
A standard HRESULT value.
This function is used by controls (such as the Web browser control) that query the host's site for the IDocHostUIHandlerDispatch
interface.
Creates a licensed control, initializes it, and hosts it in the window identified by hWnd
.
STDMETHOD(CreateControlLic)(
LPCOLESTR lpTricsData,
HWND hWnd,
IStream* pStream,
BSTR bstrLic);
bstrLic
[in] The BSTR that contains the license key for the control.
See IAxWinHostWindow::CreateControl for a description of the remaining parameters and return value.
Calling this method is equivalent to calling IAxWinHostWindowLic::CreateControlLicEx
See Hosting ActiveX Controls Using ATL AXHost for a sample that uses IAxWinHostWindowLic::CreateControlLic
.
Creates a licensed ActiveX control, initializes it, and hosts it in the specified window, similar to IAxWinHostWindow::CreateControl.
STDMETHOD(CreateControlLicEx)(
LPCOLESTR lpszTricsData,
HWND hWnd,
IStream* pStream,
IUnknown** ppUnk,
REFIID riidAdvise,
IUnknown* punkAdvise,
BSTR bstrLic);
bstrLic
[in] The BSTR that contains the license key for the control.
See IAxWinHostWindow::CreateControlEx for a description of the remaining parameters and return value.
See Hosting ActiveX Controls Using ATL AXHost for a sample that uses IAxWinHostWindowLic::CreateControlLicEx
.