L_CreateImageListControl

#include "ltlst.h"

L_LTLST_API HWND L_CreateImageListControl(dwStyle, x, y, nWidth, nHeight, hWndParent, nID, crBack)

DWORD dwStyle;

/* window style */

L_INT x;

/* horizontal position of window */

L_INT y;

/* vertical position of window */

L_INT nWidth;

/* window width */

L_INT nHeight;

/* window height */

HWND hWndParent;

/* handle to parent window */

L_INT nID;

/* control ID */

COLORREF crBack;

/* background color of control */

Creates the image list control as a child of the specified parent window.

Parameter

Description

dwStyle

Window styles for the ImageList Control window. This can be any normal window style, or ImageList style. For more information on ImageList styles, refer to LTIMAGELISTCLASS Registered Class: Styles.

x

Original horizontal position for the ImageList Control window.

y

Original horizontal position for the ImageList Control window.

nWidth

Original width for the ImageList Control window.

nHeight

Original height for the ImageList Control window.

hWndParent

Window handle of the parent window for the ImageList Control.

nID

ID for the ImageList Control. You can use this to identify the control when you process WM_COMMAND notification messages that the control will send to its parent window.

crBack

The background color for the ImageList Control window.

Returns

> 0

The function was successful, and returns the handle to the ImageList Control window.

< 0

An error occurred. Refer to Return Codes.

Comments

You can destroy the ImageListControl window using the Windows function DestroyWindow.

When the ImageList Control DLL loads, it registers a window class. The name for the ImageListControl window is:

#ifdef WIN32
 #define LTIMGLISTCLASS   TEXT("LEADIMGLIST32")
#else
 #define LTIMGLISTCLASS   TEXT("LEADIMGLIST16")
#endif

You can use this class name to create an ImageList Control in your application's resource file (.RC). If you specify an ID when creating the control, you can use the Windows function GetDlgItem to get the window handle of the ImageListControl.

Note: In WIN32 versions, the window is created with the WS_EX_CLIENTEDGE style by default. To change this, you can use the Windows function SetWindowLong.

Note: The ImageList Control Window Class allocates 8 bytes of user data. The first 4 bytes are reserved, but the second 4 bytes can be used by your application. Use SetWindowLong to set these values.

Required DLLs and Libraries

LTIMG
LTLST

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 2000 / XP/Vista, Windows CE.

See Also

Functions:

L_UseImageListControl

Topics:

ImageList Control Messages

 

ImageList Control Command Notifications

 

Using the ImageList Control

 

Using Color Values in LEADTOOLS

Example

#define IDC_LEADIMAGELIST 1200

L_INT CreateImageListControlExample(HWND hWndParent, HWND * phCtl)
{
   /* create the image list control */
   *phCtl = L_CreateImageListControl(WS_CHILD|WS_VISIBLE|WS_BORDER,
                                   10,                /* x location       */
                                   10,                /* y location       */
                                   250,               /* width            */
                                   250,               /* height           */
                                   hWndParent,        /* parent window    */
                                   IDC_LEADIMAGELIST, /* control ID       */
                                   RGB(128,128,128)); /* background color */
   if(!IsWindow(*phCtl))
   {
      MessageBox(hWndParent, TEXT("Error creating control"), TEXT("Error"), MB_OK);
      return 0;
   }
   return SUCCESS;
}