LAutomation::AddContainer

#include "ltwrappr.h"

L_INT LAutomation::AddContainer(pLContainer , pModeData)

LContainer * pLContainer;

/* pointer to a container object */

L_VOID * pModeData;

/* pointer to additional data */

Adds a new container to the automation list of containers.

Parameter

Description

pLContainer

Pointer to a container object.

pModeData

Pointer to a structure that contains information about the mode used to create the specified automation handle. If the automation handle was created using AUTOMATION_MODE_VECTOR, pModeData should point to a VECTORHANDLE structure. If the automation handle was created using AUTOMATION_MODE_PAINT, pModeData should point to a CONTAINERPAINTDATA structure.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

For an SDI application, usually a single container for the current SDI window will be added. For an MDI application, usually a new container will be added every time a new MDI child window is created.

The newly added container will become the active automation container.

Adding a new container will provide all automation functionality to the window that owns the newly added container.

To remove a container from the automation list of containers, call LAutomation::RemoveContainer.

Required DLLs and Libraries

LTAUT

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LAutomation::RemoveContainer, LContainer::Initialize, LContainer::Create

Topics:

Automation and the Container

Example

This example

* Creates a container

* Associates it with a LVectorWindow object

* Adds the container to an automation object

* Sets some container properties

L_INT LAutomation_AddContainerExample(HWND hWnd, LVectorWindow &VectorWindow, LAutomation &Automation, LContainer &Container)
{
   L_INT nRet;
   CONTAINERMETRICS ContainerMetrics;
   VectorWindow.SetWndHandle (hWnd); 
   VectorWindow.AttachToWindow(hWnd);
   nRet = Container.Initialize();
   if(nRet != SUCCESS)
      return nRet;
   nRet = Container.Create(hWnd);
   if(nRet != SUCCESS)
      return nRet;
   nRet = Automation.AddContainer(&Container, VectorWindow.GetHandle () );
   if(nRet != SUCCESS)
      return nRet;
   nRet = Automation.SetActiveContainer(&Container);
   if(nRet != SUCCESS)
      return nRet;
   ContainerMetrics.dwMask = 
      CMF_BORDERCOLOR | 
      CMF_HANDLECOLOR | 
      CMF_HANDLEHEIGHT | 
      CMF_HANDLEWIDTH | 
      CMF_ENABLEHANDLES;
   ContainerMetrics.crBorder = RGB(255,0,0);
   ContainerMetrics.crHandle = RGB(0,255,0);
   ContainerMetrics.nHandleHeight = 8;
   ContainerMetrics.nHandleWidth = 8;
   ContainerMetrics.fEnableHandles = TRUE;
   nRet = Container.SetMetrics(&ContainerMetrics);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}