#include "ltivw.h"
L_LTIVW_API L_HWND L_DispContainerGetWindowHandle(hCon, uFlags)
Returns a handle to the specified container window.
Handle to the container.
Reserved for future use. Pass 0.
Value | Meaning |
---|---|
> 0 | Handle to the container window. |
NULL | An error occurred. To get extended error information, call GetLastError, and refer to Return Codes. |
This function gets a handle to the container's window. To get a handle to the container itself, call L_DispContainerGetHandle.
Required DLLs and Libraries
This function returns the bounding rectangle that specifies the absolute position of the cell.
L_INT DispContainerGetWindowHandleExample(HDISPCONTAINER hCon,
L_INT nCellIndex,
RECT * lpRect)
{
L_INT nRet;
RECT rcRect;
POINT pt;
HWND hWndContainer, hWndCell;
// Check whether the cell index is valid or not.
L_INT nCount = L_DispContainerGetCellCount(hCon, 0);
if (nCellIndex < 0 || nCellIndex >= nCount)
return 0;
// Get the container window handle.
hWndContainer = L_DispContainerGetWindowHandle (hCon, 0);
// Get the cells bounding rectangle, the corrdinates is relative to the upperleft corner
// of the container window.
nRet = L_DispContainerGetCellBounds(hCon, nCellIndex, &rcRect, 0);
if(nRet != SUCCESS)
return nRet;
pt.x = rcRect.left;
pt.y = rcRect.top;
ClientToScreen(hWndContainer, &pt);
// Get the window handle of the cell
hWndCell = L_DispContainerGetCellWindowHandle(hCon, nCellIndex, 0);
// Get the client rect for the cell.
GetClientRect(hWndCell, &rcRect);
OffsetRect(&rcRect, pt.x, pt.y);
CopyRect(lpRect, &rcRect);
return SUCCESS;
}