L_DispContainerGetBounds

#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerGetBounds(hCon, lpRect, uFlags)

HDISPCONTAINER hCon;

/* handle to the container */

LPRECT lpRect;

/* pointer to a structure */

L_UINT uFlags;

/* reserved for future use */

Gets the bounding rectangle for the container.

Parameter

Description

hCon

Handle to the container.

lpRect

A pointer to a RECT structure to be updated with the bounding rectangle of the container.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The coordinates of lpRect are relative to the parent window coordinates. If the container window has no parent, the coordinates will be relative to the screen coordinates.

To set the bounding rectangle for the container, call L_DispContainerSetBounds.

Required DLLs and Libraries

LTIVW

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:

L_DispContainerCreate, L_DispContainerSetBounds, L_DispContainerSetProperties, L_DispContainerGetProperties, L_DispContainerGetWindowHandle, L_DispContainerDestroy

Topics:

Using the Image Viewer

 

Image Viewer Functions: Using the Image Viewer

Example

This function determines whether the container's client area is different than its parent's.

 L_INT DispContainerGetBoundsExample(HDISPCONTAINER hCon)
{
   L_INT nRet;
   RECT rcRect;
   RECT rcParentRect;
   HWND hWndParent;

   // Get the container window's parent
   hWndParent = GetParent(L_DispContainerGetWindowHandle (hCon, 0));

   // if the container has no parent then abort. 
   if (hWndParent == NULL) 
      return ERROR_NO_MEMORY ; 

   // Get the container's bonding rectangle. 
   nRet = L_DispContainerGetBounds(hCon, &rcRect, 0); 
   if(nRet != SUCCESS)
      return nRet;

   GetClientRect(hWndParent, &rcParentRect); 

   // check if the container's client area is different than the parent's client area. 
   if (((rcRect.right - rcRect.left ) != (rcParentRect.right - rcParentRect.left )) || ((rcRect.bottom - rcRect.top ) != (rcParentRect.bottom - rcParentRect.top ))) 
   {
      nRet = L_DispContainerSetBounds(hCon, &rcParentRect, 0); 
      if(nRet != SUCCESS)
         return nRet;
   }
   return SUCCESS;
}