Creates a container and attaches it to a user-defined window.
#include "LtCon.h"
L_LTCON_API L_INT L_ContainerCreate (pContainer, hwndOwner)
Pointer to a container handle.
Handle of the window that owns the container.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The container's owner window should have CS_DBLCLKS in its class style. Otherwise, some container functions will not work.
L_ContainerInit must be called before calling this function.
This example shows the minimum requirements to start using some container.
L_INT ContainerCreateExample(HWND hWnd, pCONTAINERHANDLE * ppLeadContainer)
{
L_INT nRet;
CONTAINERMETRICS Metrics ;
/* Initialize the container handle */
nRet = L_ContainerInit( ppLeadContainer ) ;
if(nRet != SUCCESS)
return nRet;
/* Create the container and attach it to its owner window */
nRet = L_ContainerCreate( *ppLeadContainer, hWnd ) ;
if(nRet != SUCCESS)
return nRet;
nRet = L_ContainerIsValid( *ppLeadContainer );
if ( SUCCESS == nRet) /* the validity of the container handle */
{
/* Set the container object type to rectangle */
nRet = L_ContainerSetObjectType( *ppLeadContainer, CONTAINER_OBJECT_TYPE_RECT ) ;
if(nRet != SUCCESS)
return nRet;
/* Initiate the container metrics */
Metrics.nSize = sizeof ( CONTAINERMETRICS ) ;
Metrics.dwMask = CMF_LIMITS ;
/* Set the container limits to some value, all container inputs (after scaling) will be restricted to this range */
SetRect ( &Metrics.rcLimits, 0, 0, 500, 500 ) ;
/* Set the container metrics */
nRet = L_ContainerSetMetrics( *ppLeadContainer, &Metrics ) ;
}
return nRet;
}