#include "ltwrappr.h"
HWND LImageViewer::GetWindowHandle (uFlags);
Returns a handle to the specified container window.
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.
Required DLLs and Libraries
This function returns the bounding rectangle that specifies the absolute position of the cell.
L_INT LImageViewer_GetWindowHandleExample(LImageViewer& ImageViewer, L_INT nCellIndex, RECT * lpRect)
{
L_INT nRet = 0;
RECT rcRect1, rcRect2 ;
POINT pt ;
CWnd wndContainer, wndCell ;
// Check whether the cell index is valid or not.
L_INT nCount = ImageViewer.GetCellCount(0);
if (nCellIndex < 0 || nCellIndex >= nCount)
{
MessageBox(NULL, TEXT("cell index is not valid!"), NULL, MB_OK) ;
return nRet;
}
// Get the cell's bounding rectangle,
//the coordinates are relative to the upper left corner of the container window.
nRet = ImageViewer.GetCellBounds(nCellIndex, &rcRect1, 0);
if(nRet != SUCCESS)
return nRet;
pt.x = rcRect1.left;
pt.y = rcRect1.top;
// Get the container window handle.
nRet = wndContainer.Attach(ImageViewer.GetWindowHandle(0));
wndContainer.ClientToScreen(&pt);
// Get the window handle of the cell
nRet = wndCell.Attach(ImageViewer.GetCellWindowHandle(nCellIndex, 0));
// Get the client rect for the cell.
wndCell.GetClientRect(&rcRect2);
OffsetRect(&rcRect2, pt.x, pt.y);
CopyRect(lpRect, &rcRect2);
wndContainer.Detach() ;
wndCell.Detach() ;
return SUCCESS;
}