Creates a container and attaches it to a user defined window.
#include "Ltwrappr.h"
L_INT LContainer::Create (hwndOwner)
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 owner window should have CS_DBLCLKS in its class style. Otherwise some container functions will not work.
LContainer::Initialize must be called before calling this function.
This example shows the minimum requirements to start using some container.
L_INT LContainer_CreateExample( HWND hWnd, LContainer & lcont)
{
L_INT nRet;
CONTAINERMETRICS Metrics ;
/* Initiate the container handle */
nRet = lcont.Initialize () ;
if(nRet != SUCCESS)
return nRet;
/* Create the container and attach it to its owner window */
nRet = lcont.Create ( hWnd ) ;
if(nRet != SUCCESS)
return nRet;
nRet = lcont.IsValid ();
if ( nRet == SUCCESS ) /* the validity of the container handle */
{
/* Set the container object type to rectangle */
nRet = lcont.SetObjectType (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 = lcont.SetMetrics ( &Metrics ) ;
if(nRet != SUCCESS)
return nRet;
}
else
{
return nRet ;
}
return SUCCESS ;
}