COccManager Class
Manages various custom control sites; implemented by COleControlContainer
and COleControlSite
objects.
class COccManager : public CNoTrackObject
Name | Description |
---|---|
COccManager::CreateContainer | Creates a COleContainer object. |
COccManager::CreateDlgControls | Creates ActiveX controls, hosted by the associated COleContainer object. |
COccManager::CreateSite | Creates a COleClientSite object. |
COccManager::GetDefBtnCode | Retrieves the code of the default button. |
COccManager::IsDialogMessage | Determines the target of a dialog message. |
COccManager::IsLabelControl | Determines if the specified control is a label control. |
COccManager::IsMatchingMnemonic | Determines if the current mnemonic matches the mnemonic of the specified control. |
COccManager::OnEvent | Attempts to handle the specified event. |
COccManager::PostCreateDialog | Frees resources allocated during dialog creation. |
COccManager::PreCreateDialog | Processes a dialog template for ActiveX controls. |
COccManager::SetDefaultButton | Toggles the default state of the specified control. |
COccManager::SplitDialogTemplate | Separates any existing ActiveX controls from common controls in the specified dialog template. |
The base class, CNoTrackObject
, is an undocumented base class (located in AFXTLS.H). Designed for use by the MFC framework, classes derived from the CNoTrackObject
class are exempt from memory leak detection. It is not recommended that you derive directly from CNoTrackObject
.
CNoTrackObject
COccManager
Header: afxocc.h
Called by the framework to create a control container.
virtual COleControlContainer* CreateContainer(CWnd* pWnd);
pWnd
A pointer to the window object associated with the custom site container.
A pointer to the newly created container; otherwise NULL.
For more information on creating custom sites, see COleControlContainer::AttachControlSite.
Call this function to create ActiveX controls specified by the pOccDialogInfo parameter.
virtual BOOL CreateDlgControls(
CWnd* pWndParent,
LPCTSTR lpszResourceName,
_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
virtual BOOL CreateDlgControls(
CWnd* pWndParent,
void* lpResource,
_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
pWndParent
A pointer to the parent of the dialog object.
lpszResourceName
The name of the resource being created.
pOccDialogInfo
A pointer to the dialog template used to create the dialog object.
lpResource
A pointer to a resource.
Nonzero if the control was created successfully; otherwise zero.
Called by the framework to create a control site, hosted by the container pointed to by pCtrlCont.
virtual COleControlSite* CreateSite(COleControlContainer* pCtrlCont);
pCtrlCont
A pointer to the control container hosting the new control site.
A pointer to the newly created control site.
Override this function to create a custom control site, using your COleControlSite-derived class.
Each control container can host multiple sites. Create additional sites with multiple calls to CreateSite
.
Call this function to determine if the control is a default push button.
static DWORD AFX_CDECL GetDefBtnCode(CWnd* pWnd);
pWnd
The window object containing the button control.
One of the following values:
DLGC_DEFPUSHBUTTON Control is the default button in the dialog.
DLGC_UNDEFPUSHBUTTON Control is not the default button in the dialog.
0 Control is not a button.
Called by the framework to determine whether a message is intended for the specified dialog box and, if it is, processes the message.
virtual BOOL IsDialogMessage(
CWnd* pWndDlg,
LPMSG lpMsg);
pWndDlg
A pointer to the intended target dialog of the message.
lpMsg
A pointer to an MSG
structure that contains the message to be checked.
Nonzero if the message is processed; otherwise zero.
The default behavior of IsDialogMessage
is to check for keyboard messages and convert them into selections for the corresponding dialog box. For example, the TAB key, when pressed, selects the next control or group of controls.
Override this function to provide custom behavior for messages sent to the specified dialog.
Call this function to determine if the specified control is a label control.
static BOOL AFX_CDECL IsLabelControl(CWnd* pWnd);
static BOOL AFX_CDECL IsLabelControl(COleControlSiteOrWnd* pWnd);
pWnd
A pointer to the window containing the control.
Nonzero if the control is a label; otherwise zero
A label control is one that acts like a label for whatever control is next in the ordering.
Call this function to determine if the current mnemonic matches that represented by the control.
static BOOL AFX_CDECL IsMatchingMnemonic(
CWnd* pWnd,
LPMSG lpMsg);
static BOOL AFX_CDECL IsMatchingMnemonic(
COleControlSiteOrWnd* pWnd,
LPMSG lpMsg);
pWnd
A pointer to the window containing the control.
lpMsg
A pointer to the message containing the mnemonic to match.
Nonzero if the mnemonic matches the control; otherwise zero
Called by the framework to handle the specified event.
virtual BOOL OnEvent(
CCmdTarget* pCmdTarget,
UINT idCtrl,
AFX_EVENT* pEvent,
AFX_CMDHANDLERINFO* pHandlerInfo);
pCmdTarget
A pointer to the CCmdTarget
object attempting to handle the event
idCtrl
The resource ID of the control.
pEvent
The event being handled.
pHandlerInfo
If not NULL, OnEvent
fills in the pTarget
and pmf
members of the AFX_CMDHANDLERINFO
structure instead of dispatching the command. Typically, this parameter should be NULL.
Nonzero if the event was handled, otherwise zero.
Override this function to customize the default event-handling process.
Called by the framework to process a dialog template for ActiveX controls before creating the actual dialog box.
virtual const DLGTEMPLATE* PreCreateDialog(
_AFX_OCC_DIALOG_INFO* pOccDialogInfo,
const DLGTEMPLATE* pOrigTemplate);
pOccDialogInfo
An _AFX_OCC_DIALOG_INFO
structure containing information on the dialog template and any ActiveX controls hosted by the dialog.
pOrigTemplate
A pointer to the dialog template to be used in creating the dialog box.
A pointer to a dialog template structure used to create the dialog box.
The default behavior makes a call to SplitDialogTemplate
, determining if there are any ActiveX controls present and then returns the resultant dialog template.
Override this function to customize the process of creating a dialog box hosting ActiveX controls.
Called by the framework to free memory allocated for the dialog template.
virtual void PostCreateDialog(_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
pOccDialogInfo
An _AFX_OCC_DIALOG_INFO
structure containing information on the dialog template and any ActiveX controls hosted by the dialog.
This memory was allocated by a call to SplitDialogTemplate
, and was used for any hosted ActiveX controls in the dialog box.
Override this function to customize the process of cleaning up any resources used by the dialog box object.
Call this function to set the control as the default button.
static void AFX_CDECL SetDefaultButton(
CWnd* pWnd,
BOOL bDefault);
pWnd
A pointer to the window containing the control.
bDefault
Nonzero if the control should become the default button; otherwise zero.
Nonzero if successful; otherwise zero.
Note
The control must have the OLEMISC_ACTSLIKEBUTTON status bit set. For more information on OLEMISC flags, see the OLEMISC topic in the Windows SDK.
Called by the framework to split the ActiveX controls from common dialog controls.
virtual DLGTEMPLATE* SplitDialogTemplate(
const DLGTEMPLATE* pTemplate,
DLGITEMTEMPLATE** ppOleDlgItems);
pTemplate
A pointer to the dialog template to be examined.
ppOleDlgItems
A list of pointers to dialog box items that are ActiveX controls.
A pointer to a dialog template structure containing only non-ActiveX controls. If no ActiveX controls are present, NULL is returned.
If any ActiveX controls are found, the template is analyzed and a new template, containing only non-ActiveX controls, is created. Any ActiveX controls found during this process are added to ppOleDlgItems.
If there are no ActiveX controls in the template, NULL is returned .
Note
Memory allocated for the new template is freed in the PostCreateDialog
function.
Override this function to customize this process.
Hierarchy Chart
COleControlSite Class
COleControlContainer Class