LImageViewer::GetWindowHandle

#include "ltwrappr.h"

HWND LImageViewer::GetWindowHandle (uFlags);

L_UINT uFlags;

/* reserved for future use */

Returns a handle to the specified container window.

Parameter

Description

uFlags

Reserved for future use. Pass 0.

Returns

> 0

Handle to the container window.

NULL

An error occurred. To get extended error information, call GetLastError, and refer to Return Codes.

Comments

This function gets a handle to the container's window.

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:

LImageViewer::Destroy, LImageViewer::SetProperties, LImageViewer::GetProperties, Class Members

Topics:

Using the Image Viewer

 

Window Control/Image Viewer Functions: Using the Image Viewer

Example

This function returns the bounding rect 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;
}