File: n_svc_imagelist.sru
Size: 69760
Date: Mon, 07 Apr 2008 21:32:15 +0200
$PBExportHeader$n_svc_imagelist.sru
$PBExportComments$ImageList Service
forward
global type n_svc_imagelist from n_svc_base
end type
type imageinfo from structure within n_svc_imagelist
end type
end forward

type imageinfo from structure
   long     hbmimage
   long     hbmmask
   long     unused1
   long     unused2
   rect     rcimage
end type

global type n_svc_imagelist from n_svc_base
end type
global n_svc_imagelist n_svc_imagelist

type prototypes
Function long ImageList_Create(long cx, long cy, ulong flags, long cInitial, long cGrow) Library "comctl32.dll"
Function long ImageList_GetImageCount(long himl) Library "comctl32.dll"
Function long ImageList_Add(long himl, long hbmImage, long hbmMask) Library "comctl32.dll"
Function long ImageList_ReplaceIcon(long himl, long i, long hicon) Library "comctl32.dll"
Function long ImageList_AddMasked( long himl, long hbmImage, ulong crMask) Library "comctl32.dll"
Function long ImageList_GetIcon( long himl, long i, ulong flags) Library "comctl32.dll"
Function long ImageList_LoadImage( long hInstance, String lpbmp, long cx, long cGrow, ulong crMask, ulong uType, ulong uFlags) Library "comctl32.dll" ALIAS FOR "ImageList_LoadImageA;Ansi"
Function long ImageList_Merge(long himl1, long i1, long himl2, long i2, long dx, long dy) Library "comctl32.dll"
Function long ImageList_GetDragImage( Ref POINT ppt, Ref POINT pptHotspot) Library "comctl32.dll"
Function ulong ImageList_SetBkColor(long himl, ulong clrBk) Library "comctl32.dll"
Function ulong ImageList_GetBkColor(long himl) Library "comctl32.dll"
Function boolean ImageList_Destroy(long himl) Library "comctl32.dll"
Function boolean ImageList_SetOverlayImage(long himl, long iImage, long iOverlay) Library "comctl32.dll"
Function boolean ImageList_Draw(long himl, long i, long hdcDst, long x, long y, ulong fStyle) Library "comctl32.dll"
Function boolean ImageList_DrawIndirect(IMAGELISTDRAWPARAMS p) Library "comctl32.dll"
Function boolean ImageList_Replace( long himl, long i, long hbmImage, long hbmMask) Library "comctl32.dll"
Function boolean ImageList_DrawEx( long himl, long i, long hdcDst, long x, long y, long dx, long dy, ulong rgbBk, ulong rgbFg, ulong fStyle) Library "comctl32.dll"
Function boolean ImageList_Remove( long himl, long i) Library "comctl32.dll"
Function boolean ImageList_BeginDrag( long himlTrack, long iTrack, long dxHotspot, long dyHotspot) Library "comctl32.dll"
Function boolean ImageList_EndDrag() Library "comctl32.dll"
Function boolean ImageList_DragEnter( long  hwndLock, long x, long y) Library "comctl32.dll"
Function boolean ImageList_DragLeave( long hwndLock) Library "comctl32.dll"
Function boolean ImageList_DragMove( long x, long y) Library "comctl32.dll"
Function boolean ImageList_SetDragCursorImage( long himlDrag, long iDrag, long dxHotspot, long dyHotspot) Library "comctl32.dll"
Function boolean ImageList_DragShowNolock( boolean fShow) Library "comctl32.dll"
Function boolean ImageList_GetIconSize(long himl, Ref long cx, Ref Long cy) Library "comctl32.dll"
Function boolean ImageList_SetIconSize(long himl, long cx, long cy) Library "comctl32.dll"
Function boolean ImageList_GetImageInfo(long himl, long i, Ref IMAGEINFO pImageInfo) Library "comctl32.dll"
Function long ImageList_Duplicate( long himl) Library "comctl32.dll"

// Stream Functions
Function long ImageList_Read( long pstm) Library "comctl32.dll"
Function boolean ImageList_Write( long himl, long pstm) Library "comctl32.dll"

//draw state for disable look non-XP
FUNCTION long DrawState(Long hdc, Long hBrush, Long lpDrawStateProc , Long lParam, Long wParam, Long X, Long Y, Long cX, Long cY, Long fuFlags) Library "user32.dll" Alias for "DrawStateA;Ansi"
end prototypes
type variables
//Image List
CONSTANT Long CLR_NONE     =  4294967295  // 0xFFFFFFFFL
CONSTANT Long CLR_DEFAULT  =  4278190080  // 0xFF000000L
CONSTANT Long CLR_HILIGHT     = CLR_DEFAULT
CONSTANT Long ILC_COLOR    = 0   // 0x0000
CONSTANT Long ILC_MASK     = 1   // 0x0001
CONSTANT Long ILC_COLOR4      = 4   // 0x0004
CONSTANT Long ILC_COLOR8      = 8   // 0x0008
CONSTANT Long ILC_COLOR16     = 16  // 0x0010
CONSTANT Long ILC_COLOR24     = 24  // 0x0018
CONSTANT Long ILC_COLOR32     = 32  // 0x0020
CONSTANT Long ILC_COLORDDB = 254 // 0x00FE
CONSTANT Long ILC_PALETTE     = 2048   // 0x0800
CONSTANT Long ILD_NORMAL      = 0   // 0x0000
CONSTANT Long ILD_TRANSPARENT = 1   // 0x0001
CONSTANT Long ILD_BLEND25     = 2   // 0x0002
CONSTANT Long ILD_BLEND50     = 4   // 0x0004
CONSTANT Long ILD_MASK     = 16  // 0x0010
CONSTANT Long ILD_IMAGE    = 32  // 0x0020
CONSTANT Long ILD_OVERLAYMASK = 3840   // 0x0F00
CONSTANT Long ILD_SELECTED = ILD_BLEND50
CONSTANT Long ILD_FOCUS    = ILD_BLEND25
CONSTANT Long ILD_BLEND    = ILD_BLEND50
CONSTANT Long IMAGE_BITMAP = 0
CONSTANT Long IMAGE_ICON      = 1
CONSTANT Long IMAGE_CURSOR = 2
CONSTANT Long IMAGE_ENHMETAFILE  = 3
CONSTANT Long LR_DEFAULTCOLOR    = 0   // 0x0000
CONSTANT Long LR_MONOCHROME      = 1   // 0x0001
CONSTANT Long LR_COLOR        = 2   // 0x0002
CONSTANT Long LR_COPYRETURNORG      = 4   // 0x0004
CONSTANT Long LR_COPYDELETEORG      = 8   // 0x0008
CONSTANT Long LR_LOADFROMFILE    = 16  // 0x0010
CONSTANT Long LR_LOADTRANSPARENT = 32  // 0x0020
CONSTANT Long LR_DEFAULTSIZE     = 64  // 0x0040
CONSTANT Long LR_VGACOLOR     = 128 // 0x0080
CONSTANT Long LR_LOADMAP3DCOLORS = 4096   // 0x1000
CONSTANT Long LR_CREATEDIBSECTION   = 8192   // 0x2000
CONSTANT Long LR_COPYFROMRESOURCE   = 16384  // 0x4000
CONSTANT Long LR_SHARED       = 32768  // 0x8000
CONSTANT Long ILS_NORMAL      = 0   // 0x00000000
CONSTANT Long ILS_SATURATE    = 4   // 0x00000004
CONSTANT Long ILS_ALPHA    = 8   // 0x00000008

CONSTANT long DST_COMPLEX = //H0
CONSTANT long DST_TEXT = //H1
CONSTANT long DST_PREFIXTEXT = //H2
CONSTANT long DST_ICON = //H3
CONSTANT long DST_BITMAP = //H4
CONSTANT long DSS_NORMAL = //H0
CONSTANT long DSS_UNION = //H10 ' Dither
CONSTANT long DSS_DISABLED = //H20
CONSTANT long DSS_MONO = //H80 ' Draw in colour of brush specified in hBrush 
CONSTANT long DSS_RIGHT = //H800
end variables
forward prototypes
public function boolean of_dragleave (readonly long hwndLock)
public function boolean of_dragmove (readonly long cx, readonly long cy)
public function boolean of_DragShowNolock (readonly boolean fshow)
public function boolean of_enddrag ()
public function long of_loadimage (readonly long hinstance, readonly string lpbmp, readonly long cx, readonly long cgrow, readonly unsignedlong crmask, readonly unsignedlong utype, readonly unsignedlong uflags)
public function long of_loadbitmap (readonly long hinstance, readonly string lpbmp, readonly long cx, readonly long cgrow, readonly long crmask)
public function long of_merge (readonly long himl1, readonly long i1, readonly long himl2, readonly long i2, readonly long dx, readonly long dy)
public function long of_read (readonly long pstm)
public function boolean of_setdragcursorimage (readonly long himlDrag, readonly long iDrag, readonly long dxHotspot, readonly long dyHotspot)
public function long of_getdragimage (ref long cx, ref long cy, ref long dx, ref long dy)
public function long of_create (readonly long cx, readonly long cy, readonly unsignedlong flags, readonly long cinitial, readonly long cgrow)
public function long of_add (readonly long al_handle, readonly long hbmimage, readonly long hbmmask)
public function long of_addicon (readonly long al_handle, readonly long hicon)
public function long of_replaceicon (readonly long al_handle, readonly long i, readonly long hicon)
public function long of_addmasked (readonly long al_handle, readonly long hbmimage, readonly long crmask)
public function boolean of_begindrag (readonly long al_handle, readonly long itrack, readonly long dxhotspot, readonly long dyhotspot)
public function boolean of_destroy (readonly long al_handle)
public function boolean of_dragenter (readonly long hwndlock, readonly long cx, readonly long cy)
public function boolean of_draw (long al_handle, readonly long i, readonly long hdcdst, readonly long cx, readonly long cy, readonly unsignedlong fstyle)
public function boolean of_drawex (long al_handle, readonly long i, readonly long hdcdst, readonly long cx, readonly long cy, readonly long dx, readonly long dy, readonly unsignedlong rgbbk, readonly unsignedlong rgbfg, readonly unsignedlong fstyle)
public function long of_geticon (readonly long al_handle, readonly long i, readonly long flags)
public function long of_extracticon (readonly long al_handle, readonly long i)
public function unsignedlong of_getbkcolor (readonly long al_handle)
public function boolean of_geticonsize (readonly long al_handle, ref long cx, ref long cy)
public function long of_getimagecount (readonly long al_handle)
public function boolean of_getimageinfo (readonly long al_handle, readonly long i, ref imageinfo pimageinfo)
public function boolean of_remove (readonly long al_handle, readonly long i)
public function boolean of_removeall (readonly long al_handle)
public function boolean of_replace (readonly long al_handle, readonly long i, readonly long hbmimage, readonly long hbmmask)
public function unsignedlong of_setbkcolor (readonly long al_handle, readonly unsignedlong clrbk)
public function boolean of_seticonsize (readonly long al_handle, readonly long cx, readonly long cy)
public function boolean of_setoverlayimage (readonly long al_handle, readonly long iimage, readonly long ioverlay)
public function boolean of_write (long al_handle, readonly long pstm)
public function long of_duplicate (readonly long al_himl)
public function long of_icontobitmapfile (ref n_svc_mgr anv_svc, readonly long al_himl, readonly integer ai_index, readonly integer ai_size, readonly long al_backcolor, readonly string as_filename)
public function boolean of_drawdisabled (ref n_svc_mgr anv_svc, long al_handle, readonly long i, readonly long hdcdst, readonly long cx, readonly long cy)
public function long of_icontobitmapfile (ref n_svc_mgr anv_svc, readonly long al_himl, readonly integer ai_index, readonly integer ai_size, readonly long al_backcolor, readonly long al_backcolor2, readonly boolean ab_vertical, readonly integer ai_gradientoffset, readonly boolean ab_disabled, readonly string as_filename)
end prototypes

public function boolean of_dragleave (readonly long hwndLock);//===================================================================
// Function:   nvo_comctl_imagelist::of_DragLeave()
//-------------------------------------------------------------------
// Description:The ImageList_DragLeave function unlocks the specified
//             window and hides the drag image, allowing the window 
//             to be updated. 
//-------------------------------------------------------------------
// Parameters: 
//
// hwndLock
//    Handle to the window that owns the drag image. 
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_DragLeave( hwndLock )

end function

public function boolean of_dragmove (readonly long cx, readonly long cy);//===================================================================
// Function:   nvo_comctl_imagelist::of_DragMove()
//-------------------------------------------------------------------
// Description:The ImageList_DragMove function moves the image that 
//             is being dragged during a drag-and-drop operation. 
//             This function is typically called in response to a 
//             WM_MOUSEMOVE message.
//
// NOTE: To begin a drag operation, use the ImageList_BeginDrag function.
//-------------------------------------------------------------------
// Parameters: 
//
// x
//    Specifies the x-coordinate at which to display the drag image. 
//    The coordinate is relative to the upper-left corner of the window, 
//    not the client area.
// y
//    Specifies the y-coordinate at which to display the drag image. 
//    The coordinate is relative to the upper-left corner of the window, 
//    not the client area.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_DragMove( cx, cy )

end function

public function boolean of_DragShowNolock (readonly boolean fshow);//===================================================================
// Function:   nvo_comctl_imagelist::of_DragShowNolock()
//-------------------------------------------------------------------
// Description:The ImageList_DragShowNolock function shows or hides 
//             the image being dragged. 
//-------------------------------------------------------------------
// Parameters: 
//
// fShow
//    Value specifying whether to show or hide the image being dragged. 
//    Specify TRUE to show the image, FALSE to hide the image.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_DragShowNolock( fShow )

end function

public function boolean of_enddrag ();//===================================================================
// Function:   nvo_comctl_imagelist::of_EndDrag()
//-------------------------------------------------------------------
// Description:The ImageList_EndDrag function ends a drag operation.
//-------------------------------------------------------------------
// Parameters: <none>
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_EndDrag()

end function

public function long of_loadimage (readonly long hinstance, readonly string lpbmp, readonly long cx, readonly long cgrow, readonly unsignedlong crmask, readonly unsignedlong utype, readonly unsignedlong uflags);//===================================================================
// Function:   nvo_comctl_imagelist::of_LoadImage()
//-------------------------------------------------------------------
// Description:The ImageList_LoadImage function creates an image list
//             from the specified bitmap, cursor, or icon resource.
//-------------------------------------------------------------------
// Parameters: 
//
// hi
//    Handle to the instance that contains the resource. 
//    If the hi parameter is zero, the low-order word of this parameter 
//    must be the identifier of the OEM image to load. The OEM image 
//    identifiers are defined in WINUSER.H. Following are the identifier 
//    prefixes and their meanings:
//
//    Prefix   Meaning
//    OBM_     OEM bitmaps
//    OIC_     OEM icons
//    OCR_     OEM cursors
//
// lpbmsp
//    Pointer to a null-terminated string that contains the name of the 
//    image to load. If the uFlags parameter specifies the n_constants.LR_LOADFROMFILE 
//    value, the lpbmp parameter must be the name of the file that 
//    contains the image. 
// cx
//    Width of each image. The height of each image and the initial number 
//    of images are inferred by the dimensions of the specified resource.
// cGrow
//    Amount of images by which the image list can grow when the system 
//    needs to resize the list to make room for new images. This parameter 
//    represents the number of new images that the resized image list can contain.
// crMask
//    Color used to generate a mask. Each pixel of this color in the specified 
//    bitmap, cursor, or icon is changed to black, and the corresponding bit in 
//    the mask is set to 1. If this parameter is the n_constants.Cn_constants.LR_NONE value, no mask is 
//    generated.
// uType
//    Flag that specifies the type of image to load. This parameter can be one 
//    of the following values:
//
//    Value          Meaning
//    n_constants.IMAGE_BITMAP   Loads a bitmap.
//    n_constants.IMAGE_CURSOR   Loads a cursor.
//    n_constants.IMAGE_ICON     Loads an icon.
//
// uFlags
//    Flags that specify how to load the image. This parameter can be a
//    combination of the following values:
//
//    Value Meaning
//    n_constants.LR_DEFAULTCOLOR      Uses the color format of the display.
//    n_constants.LR_LOADDEFAULTSIZE   Uses the width or height specified by the system 
//                         metric values for cursors and icons if the cx 
//                         parameter is set to zero. If this value is not 
//                         specified and cx is set to zero, the function sets 
//                         the size to that specified in the resource. 
//                         If the resource contains multiple images, the 
//                         function sets the size to that of the first image. 
//    n_constants.LR_LOADFROMFILE      Loads the image from the file specified by the 
//                         lpbmp parameter.
//    n_constants.LR_LOADMAP3DCOLORS   Searches the color table for the image and replaces 
//                         the following shades of gray with the corresponding 
//                         three-dimensional color:
//
//                         Dk Gray,
//                         RGB(128, 128, 128)   COLOR_3DSHADOW
//                         Gray, 
//                         RGB(192, 192, 192)   COLOR_3DFACE
//                         Lt Gray, 
//                         RGB(223, 223, 223)   COLOR_3DLIGHT
//    n_constants.LR_LOADTRANSPARENT   Retrieves the color value of the first pixel in the 
//                         image and replaces the corresponding entry in the 
//                         color table with the default window color 
//                         (the COLOR_WINDOW display color). All pixels in the 
//                         image that use that entry become the default window 
//                         value color. This value applies only to images that 
//                         have corresponding color tables. 
//    n_constants.LR_MONOCHROME        Loads the image in black and white.
//    n_constants.LR_SHARED            Shares the image handle if the image is loaded 
//                         multiple times. Do not use this value for images 
//                         that have nontraditional sizes that might change 
//                         after loading or for images that are loaded from a file. 
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the handle 
//          of the image list.
//          If the function fails, the return value is NULL.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_LoadImage( hinstance, lpbmp, cx, cGrow, crMask, uType, uFlags )

end function

public function long of_loadbitmap (readonly long hinstance, readonly string lpbmp, readonly long cx, readonly long cgrow, readonly long crmask);//===================================================================
// Function:   nvo_comctl_imagelist::of_LoadBitmap()
//-------------------------------------------------------------------
// Description:The ImageList_LoadBitmap function creates an image 
//             list from the specified bitmap resource. 
//             ImageList_LoadBitmap is a macro that calls the 
//             ImageList_LoadImage function.
//-------------------------------------------------------------------
// Parameters: 
//
// hi 
//    Handle to the instance that contains the bitmap resource. 
// lpbmp
//    Name of the resource.
// cx
//    Width of each image. The height of each image and the initial number
//    of images are inferred by the dimensions of the specified bitmap.
// cGrow
//    Amount of images by which the image list can grow when the system 
//    needs to resize the list to make room for new images. 
//    This parameter represents the number of new images that the resized 
//    image list can contain.
// crMask
//    Color used to generate a mask. Each pixel of this color in the 
//    specified bitmap is changed to black, and the corresponding bit in 
//    the mask is set to one. 
//    If this parameter is the n_constants.Cn_constants.LR_NONE value, no mask is generated.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the image list.
//          If the function fails, the return value is NULL.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN This.of_LoadImage(hInstance, lpBmp, cx, cGrow, crMask, IMAGE_BITMAP, 0)

end function

public function long of_merge (readonly long himl1, readonly long i1, readonly long himl2, readonly long i2, readonly long dx, readonly long dy);//===================================================================
// Function:   nvo_comctl_imagelist::of_Merge()
//-------------------------------------------------------------------
// Description:The ImageList_Merge function creates a new image by 
//             combining two existing images. The function also 
//             creates a new image list to store the image.
//
// NOTE: The new image consists of the second existing image drawn 
//       transparently over the first. The mask for the new image 
//       is the result of performing a logical OR operation on the 
//       masks of the two existing images.
//-------------------------------------------------------------------
// Parameters: 
//
// himl1 
//    Handle to the first image list.
// i1
//    Index of the first existing image.
// himl2 
//    Handle to the second image list.
// i2
//    Index of the second existing image.
// dx and dy
//    Offset of the second image relative to the first image.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the handle 
//          of the new image list.
//          If the function fails, the return value is NULL.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_Merge( himl1, i1, himl2, i2, dx, dy )

end function

public function long of_read (readonly long pstm);//===================================================================
// Function:   nvo_comctl_imagelist::of_Read()
//-------------------------------------------------------------------
// Description:The ImageList_Read function reads an image list from a stream.
//
// NOTE: This function will set the internal imagelist handle
//       to the imagelist that has just been read from the stream.
//-------------------------------------------------------------------
// Parameters: 
//
// pstm
//    Pointer to the stream. 
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the image list.
//          If the function fails, the return value is -1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_Read( pstm )
end function

public function boolean of_setdragcursorimage (readonly long himlDrag, readonly long iDrag, readonly long dxHotspot, readonly long dyHotspot);//===================================================================
// Function:   nvo_comctl_imagelist::of_SetDragCursorImage()
//-------------------------------------------------------------------
// Description:The ImageList_SetDragCursorImage function creates a 
//             new drag image by combining the specified image 
//             (typically a mouse cursor image) with the current drag image. 
//-------------------------------------------------------------------
// Parameters: 
//
// himlDrag
//    Handle to the image list that contains the new image to combine 
//    with the drag image.
// iDrag
//    Index of the new image to combine with the drag image.
// dxHotspot and dyHotspot
//    Position of the hot spot within the new image. 
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_SetDragCursorImage( himlDrag, iDrag, dxHotspot, dyHotspot )

end function

public function long of_getdragimage (ref long cx, ref long cy, ref long dx, ref long dy);//===================================================================
// Function:   nvo_comctl_imagelist::of_GetDragImage()
//-------------------------------------------------------------------
// Description:The ImageList_GetDragImage function retrieves the 
//             temporary image list that is used for the drag image. 
//             The function also retrieves the current drag position, 
//             and the offset of the drag image relative to the drag 
//             position. 
//
// NOTE: The temporary image list is destroyed when the ImageList_EndDrag 
//       function is called. To begin a drag operation, use the 
//       ImageList_BeginDrag function.
//-------------------------------------------------------------------
// Parameters: 
//
// ppt
//    Pointer to a POINT structure that receives the current drag 
//    position. Can be NULL.
// pptHotSpot
//    Pointer to a POINT structure that receives the offset of the 
//    drag image relative to the drag position. Can be NULL.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the handle 
//          of the image list.
//          If the function fails, the return value is -1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

long  llhImageList
POINT lpDrag, lpHotSpot

llhImageList = ImageList_GetDragImage( lpDrag, lpHotSpot )

IF (llhImageList > 0) THEN
   // Dereference POINT structure and set reference arguments
   cx = lpDrag.pX
   cy = lpDrag.pY
   dx = lpHotSpot.pX
   dy = lpHotSpot.pY
ELSE
   // Set reference arguments and return value
   llhImageList = -1
   cx = -1
   cy = -1
   dx = -1
   dy = -1
END IF

RETURN llhImageList

end function

public function long of_create (readonly long cx, readonly long cy, readonly unsignedlong flags, readonly long cinitial, readonly long cgrow);//===================================================================
// Function:   nvo_comctl_imagelist::of_Create()
//-------------------------------------------------------------------
// Description:The ImageList_Create function creates a new image list.
//-------------------------------------------------------------------
// Parameters: 
//
// cx
//    Specifies the width, in pixels, of each image.
// cy
//    Specifies the height, in pixels, of each image.
// flags
//    A set of bit flags that specify the type of image list to create. 
//    This parameter can be a combination of the following values, 
//    but it can include only one of the n_constants.ILC_COLOR values.  
//
//    Value          Meaning
//    -----          -------
//    n_constants.ILC_COLOR      Use the default behavior if none of the other n_constants.ILC_COLOR* 
//                   flags is specified. Typically, the default is n_constants.ILC_COLOR4; 
//                   but for older display drivers, the default is n_constants.ILC_COLORDDB.
//    n_constants.ILC_COLOR4     Use a 4-bit (16 color) device-independent bitmap (DIB) 
//                   section as the bitmap for the image list. 
//    n_constants.ILC_COLOR8     Use an 8-bit DIB section. The colors used for the color 
//                   table are the same colors as the halftone palette. 
//    n_constants.ILC_COLOR16    Use a 16-bit  (32/64k color) DIB section.
//    n_constants.ILC_COLOR24    Use a 24-bit DIB section.
//    n_constants.ILC_COLOR32    Use a 32-bit DIB section.
//    n_constants.ILC_COLORDDB   Use a device-dependent bitmap.
//    n_constants.ILC_MASK       Uses a mask. The image list contains two bitmaps, 
//                   one of which is a monochrome bitmap used as a mask. 
//                   If this value is not included, the image list contains 
//                   only one bitmap.
// cInitial
//    Number of images that the image list initially contains. 
// cGrow
//    Amount of images by which the image list can grow when the system 
//    needs to resize the list to make room for new images. 
//    This parameter represents the number of new images that the resized 
//    image list can contain.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the Handle to the Imagelist
//          If the function fails, the return value is -1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_Create( cx, cy, flags, cInitial, cGrow )
end function

public function long of_add (readonly long al_handle, readonly long hbmimage, readonly long hbmmask);//===================================================================
// Function:   nvo_comctl_imagelist::of_Add()
//-------------------------------------------------------------------
// Description:The ImageList_Add function adds image(s) to an image list.
//
// NOTE: The ImageList_Add function copies the bitmap to an internal 
//       data structure. Be sure to use the DeleteObject (API) function 
//       to delete hbmImage and hbmMask after the function returns.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// hbmImage
//    Handle to the bitmap that contains the image or images. 
//    The number of images is inferred from the width of the bitmap.
// hbmMask
//    Handle to the bitmap that contains the mask. 
//    If no mask is used with the image list, this parameter is ignored.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the index
//          of the first new image.
//          If the function fails, the return value is - 1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_Add(al_handle, hbmImage, hbmMask)
ELSE
   RETURN CRet.FAILURE
END IF
end function

public function long of_addicon (readonly long al_handle, readonly long hicon);//===================================================================
// Function:   nvo_comctl_imagelist::of_AddIcon()
//-------------------------------------------------------------------
// Description:The ImageList_AddIcon macro adds an icon or cursor 
//             to an image list. This is a macro function that
//             calls the ImageList_ReplaceIcon function.
//
// NOTE: Because the system does not save hicon, you can destroy it 
//       after the macro returns if the icon or cursor was created 
//       by the CreateIcon function. 
//       You do not need to destroy hicon if it was loaded by the 
//       LoadIcon function; the system automatically frees an icon 
//       resource when it is no longer needed. 
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list. If this parameter identifies a masked 
//    image list, the macro copies both the image and mask bitmaps of 
//    the icon or cursor. 
//    If this parameter identifies a nonmasked image list, the macro 
//    copies only the image bitmap. 
// hicon
//    Handle to the icon or cursor that contains the bitmap and mask 
//    for the new image. 
//-------------------------------------------------------------------
// Returns: If the macro succeeds, the return value is the index of 
//          the new image.
//          If the macro fails, the return value is  - 1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN This.of_ReplaceIcon(al_handle, -1, hIcon)

end function

public function long of_replaceicon (readonly long al_handle, readonly long i, readonly long hicon);//===================================================================
// Function:   nvo_comctl_imagelist::of_ReplaceIcon()
//-------------------------------------------------------------------
// Description:The ImageList_ReplaceIcon function replaces an image 
//             with an icon or cursor.
//
// NOTE: Because the system does not save hicon, you can destroy it 
//       after the function returns if the icon or cursor was created 
//       by the CreateIcon function. 
//       You do not need to destroy hicon if it was loaded by the 
//       LoadIcon function; the system automatically frees an icon 
//       resource when it is no longer needed. 
//-------------------------------------------------------------------
// Parameters: 
//
// himl 
//    Handle to the image list.
// i
//    Index of the image to replace.
// hicon
//    Handle to the icon or cursor that contains the bitmap and 
//    mask for the new image.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the 
//          index of the image.
//          If the function fails, the return value is -1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_ReplaceIcon(al_handle, i, hicon )
ELSE
   RETURN CRet.FAILURE
END IF

end function

public function long of_addmasked (readonly long al_handle, readonly long hbmimage, readonly long crmask);//===================================================================
// Function:   nvo_comctl_imagelist::of_AddMasked()
//-------------------------------------------------------------------
// Description:The ImageList_AddMasked function adds an image or 
//             images to an image list, generating a mask from the 
//             specified bitmap.
//
// NOTE: The ImageList_AddMasked function copies the bitmap to an 
//       internal data structure. Be sure to use the DeleteObject 
//       function to delete hbmImage and crMask after the function returns.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// hbmImage
//    Handle to the bitmap that contains one or more images. 
//    The number of images is inferred from the width of the bitmap.
// crMask
//    Color used to generate the mask. Each pixel of this color in 
//    the specified bitmap is changed to black, and the corresponding 
//    bit in the mask is set to one.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the index 
//          of the first new image.
//          If the function fails, the return value is -1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_AddMasked(al_handle, hbmImage, crMask )
ELSE
   RETURN CRet.FAILURE
END IF

end function

public function boolean of_begindrag (readonly long al_handle, readonly long itrack, readonly long dxhotspot, readonly long dyhotspot);//===================================================================
// Function:   nvo_comctl_imagelist::of_BeginDrag()
//-------------------------------------------------------------------
// Description:The ImageList_BeginDrag function begins dragging an image.
//
// NOTE: This function creates a temporary image list that is used 
//       for dragging. In response to subsequent WM_MOUSEMOVE messages, 
//       you can move the drag image by using the ImageList_DragMove 
//       function. To end the drag operation, you can use the 
//       ImageList_EndDrag function.
//-------------------------------------------------------------------
// Parameters: 
//
// himlTrack 
//    Handle to the image list.
// iTrack
//    Index of the image to drag.
// dxHotspot and dyHotspot
//    Location of the drag position relative to the upper-left 
//    corner of the image.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_BeginDrag(al_handle, iTrack, dxHotspot, dyHotspot )
ELSE
   RETURN FALSE
END IF

end function

public function boolean of_destroy (readonly long al_handle);//===================================================================
// Function:   nvo_comctl_imagelist::of_Destroy()
//-------------------------------------------------------------------
// Description:The ImageList_Create function destroys an image list.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list to destroy.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_Destroy(al_handle)
ELSE
   RETURN TRUE
END IF

end function

public function boolean of_dragenter (readonly long hwndlock, readonly long cx, readonly long cy);//===================================================================
// Function:   nvo_comctl_imagelist::of_DragEnter()
//-------------------------------------------------------------------
// Description:The ImageList_DragEnter function locks updates to the 
//             specified window during a drag operation and displays 
//             the drag image at the specified position within the window. 
//
// NOTE: To begin a drag operation, use the ImageList_BeginDrag function.
//-------------------------------------------------------------------
// Parameters: 
//
// hwndLock
//    Handle to the window that owns the drag image.
// x 
//    Specifies the x-coordinate at which to display the drag image. 
//    The coordinate is relative to the upper-left corner of the window, 
//    not the client area.
// y
//    Specifies the y-coordinate at which to display the drag image. 
//    The coordinate is relative to the upper-left corner of the window, 
//    not the client area.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN ImageList_DragEnter( hwndLock, cx, cy )

end function

public function boolean of_draw (long al_handle, readonly long i, readonly long hdcdst, readonly long cx, readonly long cy, readonly unsignedlong fstyle);//===================================================================
// Function:   nvo_comctl_imagelist::of_Draw()
//-------------------------------------------------------------------
// Description:The ImageList_Draw function draws an image list item 
//             in the specified device context.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// i
//    Specifies the index of the image to draw.
// hdcDst
//    Handle to the destination device context.
// x 
//    Specifies the x-coordinate at which to draw within the specified device context.
// y
//    Specifies the y-coordinate at which to draw within the specified device context.
// fStyle
//    Flag specifying the drawing style. This parameter can be one or 
//    more of the following values:
//
//    Value          Meaning
//    n_constants.ILD_BLEND25,
//    n_constants.ILD_FOCUS      Draws the image, blending 25 percent with the system 
//                   highlight color. This value has no effect if the 
//                   image list does not contain a mask.
//    n_constants.ILD_BLEND50, 
//    n_constants.ILD_SELECTED, 
//    n_constants.ILD_BLEND      Draws the image, blending 50 percent with the system 
//                   highlight color. This value has no effect if the 
//                   image list does not contain a mask.
//    n_constants.ILD_MASK       Draws the mask.
//    n_constants.ILD_NORMAL     Draws the image using the background color for the 
//                   image list. If the background color is the n_constants.Cn_constants.LR_NONE 
//                   value, the image is drawn transparently using the mask.
//    n_constants.ILD_TRANSPARENT   Draws the image transparently using the mask, 
//                   regardless of the background color. This value has no 
//                   effect if the image list does not contain a mask.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_Draw(al_handle, i, hdcDst, cx, cy, fStyle )
ELSE
   RETURN FALSE
END IF

end function

public function boolean of_drawex (long al_handle, readonly long i, readonly long hdcdst, readonly long cx, readonly long cy, readonly long dx, readonly long dy, readonly unsignedlong rgbbk, readonly unsignedlong rgbfg, readonly unsignedlong fstyle);//===================================================================
// Function:   nvo_comctl_imagelist::of_DrawEX()
//-------------------------------------------------------------------
// Description:The ImageList_DrawEx function draws an image list item 
//             in the specified device context. The function uses the 
//             specified drawing style and blends the image with the 
//             specified color. 
//-------------------------------------------------------------------
// Parameters: 
//
// himl 
//    Handle to the image list
// i
//    Index of the image to draw.
// hdcDst
//    Handle to the destination device context.
// x 
//    Specifies the x-coordinate at which to draw within the 
//    specified device context.
// y
//    Specifies the y-coordinate at which to draw within the 
//    specified device context.
// dx
//    Specifies the width of the portion of the image to draw, 
//    relative to the upper-left corner of the image. 
//    If dx and dy are zero, the function draws the entire image. 
//    The function does not ensure that the parameters are valid. 
// dy
//    Specifies the height of the portion of the image to draw, 
//    relative to the upper-left corner of the image. 
//    If dx and dy are zero, the function draws the entire image. 
//    The function does not ensure that the parameters are valid. 
// rgbBk
//    Background color of the image. This parameter can be an 
//    application-defined RGB value or one of the following values:
//
//    Value       Meaning
//    n_constants.Cn_constants.LR_NONE    No background color. The image is drawn transparently.
//    n_constants.Cn_constants.LR_DEFAULT Default background color. The image is drawn using the 
//                background color of the image list.
//
//    This parameter is used only if the image list identified by himl 
//    was created with the n_constants.ILC_MASK value.
// rgbFg
//    Foreground color of the image. This parameter can be an 
//    application-defined RGB value or one of the following values:
//
//    Value       Meaning
//    n_constants.Cn_constants.LR_NONE    No blend color. The image is blended with the color 
//                of the destination device context.
//    n_constants.Cn_constants.LR_DEFAULT Default foreground color. The image is drawn using 
//                the system highlight color as the foreground color. 
//
//    This parameter is used only if fStyle includes the n_constants.ILD_BLEND25 
//    or n_constants.ILD_BLEND50 value. 
// fStyle
//    Flag specifying the drawing style. This parameter can be one or 
//    more of the following values: 
//
//    Value          Meaning
//    n_constants.ILD_BLEND25, 
//    n_constants.ILD_FOCUS      Draws the image, blending 25 percent with the 
//                   blend color specified by rgbFG. This value has no 
//                   effect if the image list does not contain a mask.
//    n_constants.ILD_BLEND50, 
//    n_constants.ILD_SELECTED, 
//    n_constants.ILD_BLEND      Draws the image, blending 50 percent with the blend 
//                   color specified by rgbFG. This value has no effect 
//                   if the image list does not contain a mask.
//    n_constants.ILD_MASK       Draws the mask.
//    n_constants.ILD_NORMAL     Draws the image using the background color for the 
//                   image list. If the background color is the n_constants.Cn_constants.LR_NONE 
//                   value, the image is drawn transparently using the mask.
//    n_constants.ILD_TRANSPARENT   Draws the image transparently using the mask, 
//                   regardless of the background color. This value has 
//                   no effect if the image list does not contain a mask.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_DrawEX(al_handle, i, hdcDst, cx, cy, dx, dy, rgbBk, rgbFg, fStyle)
ELSE
   RETURN FALSE
END IF

end function

public function long of_geticon (readonly long al_handle, readonly long i, readonly long flags);//===================================================================
// Function:   nvo_comctl_imagelist::of_GetIcon()
//-------------------------------------------------------------------
// Description:The ImageList_GetIcon function creates an icon or 
//             cursor based on an image and mask in an image list.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// i
//    Index of the image.
// flags
//    Combination of flags that specify the drawing style. For a list 
//    of values, see the description of the ImageList_Draw function. 
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the 
//          handle of the icon or cursor.
//          If the function fails, the return value is -1.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_GetIcon(al_handle, i, flags)
ELSE
   RETURN -1
END IF

end function

public function long of_extracticon (readonly long al_handle, readonly long i);//===================================================================
// Function:   nvo_comctl_imagelist::of_ExtractIcon()
//-------------------------------------------------------------------
// Description:The ImageList_ExtractIcon function creates an icon or 
//             cursor based on an image and mask in an image list. 
//             ImageList_ExtractIcon is a macro that calls the 
//             ImageList_GetIcon function.
//-------------------------------------------------------------------
// Parameters: 
//
// hInstance
//    Ignored; set to zero. 
// himl 
//    Handle to the image list.
// i
//    Index of the image.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the handle
//          of the icon or cursor.
//          If the function fails, the return value is NULL.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN This.of_GetIcon(al_handle, i, 0)

end function

public function unsignedlong of_getbkcolor (readonly long al_handle);//===================================================================
// Function:   nvo_comctl_imagelist::of_GetBKColor()
//-------------------------------------------------------------------
// Description:The ImageList_GetBkColor function retrieves the 
//             current background color for an image list.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
//-------------------------------------------------------------------
// Returns: The return value is the background color.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_GetBKColor(al_handle)
ELSE
   RETURN CLR_NONE
END IF

end function

public function boolean of_geticonsize (readonly long al_handle, ref long cx, ref long cy);//===================================================================
// Function:   nvo_comctl_imagelist::of_GetIconSize()
//-------------------------------------------------------------------
// Description:The ImageList_GetIconSize function retrieves the 
//             dimensions of images in an image list. 
//             All images in an image list have the same dimensions.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// cx
//    Pointer to integer variable that receives the width, in pixels, 
//    of each image.
// cy
//    Pointer to integer variable that receives the height, in pixels, 
//    of each image.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_GetIconSize(al_handle, cx, cy)
ELSE
   cx = -1
   cy = -1
   RETURN FALSE
END IF

end function

public function long of_getimagecount (readonly long al_handle);//===================================================================
// Function:   nvo_comctl_imagelist::of_GetImageCount()
//-------------------------------------------------------------------
// Description:The ImageList_GetImageCount function retrieves the 
//             number of images in an image list.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
//-------------------------------------------------------------------
// Returns: The number of images in the imagelist.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_GetImageCount(al_handle)
ELSE
   RETURN CRet.FAILURE
END IF

end function

public function boolean of_getimageinfo (readonly long al_handle, readonly long i, ref imageinfo pimageinfo);//===================================================================
// Function:   nvo_comctl_imagelist::of_GetImageInfo()
//-------------------------------------------------------------------
// Description:The ImageList_GetImageInfo function retrieves 
//             information about an image.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// i
//    Index of the image.
// pImageInfo
//    Pointer to an IMAGEINFO structure that receives information 
//    about the image. The information in this structure can be used 
//    to directly manipulate the bitmaps for the image.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_GetImageInfo(al_handle, i, pImageInfo)
ELSE
   RETURN FALSE
END IF

end function

public function boolean of_remove (readonly long al_handle, readonly long i);//===================================================================
// Function:   nvo_comctl_imagelist::of_Remove()
//-------------------------------------------------------------------
// Description:The ImageList_Remove function removes an image from an image list.
//-------------------------------------------------------------------
// Parameters: 
//
// himl 
//    Handle to the image list.
// i
//    Index of the image to remove. If the i parameter is -1, 
//    the function removes all images (see of_RemoveAll())
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_Remove(al_handle, i)
ELSE
   RETURN FALSE
END IF

end function

public function boolean of_removeall (readonly long al_handle);//===================================================================
// Function:   nvo_comctl_imagelist::of_RemoveAll()
//-------------------------------------------------------------------
// Description:The ImageList_RemoveAll function removes all images
//             from an image list.
//
// NOTE: This is a macro function that calls of_Remove()
//-------------------------------------------------------------------
// Parameters: <none>
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

RETURN This.of_Remove(al_handle, -1)

end function

public function boolean of_replace (readonly long al_handle, readonly long i, readonly long hbmimage, readonly long hbmmask);//===================================================================
// Function:   nvo_comctl_imagelist::of_Replace()
//-------------------------------------------------------------------
// Description:The ImageList_Replace function replaces an image in an 
//             image list with a new image.
//
// NOTE: The ImageList_Replace function copies the bitmap to an 
//       internal data structure. Be sure to use the DeleteObject (API)
//       function to delete hbmImage and hbmMask after the function returns.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// i
//    Index of the image to replace.
// hbmImage
//    Handle to the bitmap that contains the image.
// hbmMask
//    Handle to the bitmap that contains the mask. If no mask is used 
//    with the image list, this parameter is ignored.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_Replace(al_handle, i, hbmImage, hbmMask)
ELSE
   RETURN FALSE
END IF

end function

public function unsignedlong of_setbkcolor (readonly long al_handle, readonly unsignedlong clrbk);//===================================================================
// Function:   nvo_comctl_imagelist::of_SetBKColor()
//-------------------------------------------------------------------
// Description:The ImageList_SetBkColor function sets the background 
//             color for an image list.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// clrBk
//    Background color to set. This parameter can be the n_constants.Cn_constants.LR_NONE value; 
//    in that case, images are drawn transparently using the mask.
//    Use the RGB() function to get the color value.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is the 
//          previous background color.
//          If the function fails, the return value is the n_constants.Cn_constants.LR_NONE value.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_SetBKColor(al_handle, clrBk)
ELSE
   RETURN CLR_NONE
END IF

end function

public function boolean of_seticonsize (readonly long al_handle, readonly long cx, readonly long cy);//===================================================================
// Function:   nvo_comctl_imagelist::of_SetIconSize()
//-------------------------------------------------------------------
// Description:The ImageList_SetIconSize function sets the dimensions 
//             of images in an image list and removes all images from the list. 
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// cx 
//    Width, in pixels, of the images in the image list. All images 
//    in an image list have the same dimensions.
// cy
//    Height, in pixels, of the images in the image list. All images 
//    in an image list have the same dimensions.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_SetIconSize(al_handle, cx, cy)
ELSE
   RETURN FALSE
END IF

end function

public function boolean of_setoverlayimage (readonly long al_handle, readonly long iimage, readonly long ioverlay);//===================================================================
// Function:   nvo_comctl_imagelist::of_SetOverlayImage()
//-------------------------------------------------------------------
// Description:The ImageList_SetOverlayImage function adds the index
//             of an image to the list of images to be used as 
//             overlay masks. 
//             Up to four indices can be added to the list. 
//
// NOTE: An overlay mask is an image drawn transparently over another 
//       image. You draw an overlay mask over an image by using the 
//       ImageList_Draw or ImageList_DrawEx function with the index 
//       of the overlay mask. 
//       The index must be specified by using the INDEXTOOVERLAYMASK macro. 
//-------------------------------------------------------------------
// Parameters: 
//
// himl 
//    Handle to the image list.
// iImage
//    Image to use as an overlay mask.
// iOverlay
//    One-based index of the overlay mask. 
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_SetOverlayImage(al_handle, iImage, iOverlay)
ELSE
   RETURN FALSE
END IF

end function

public function boolean of_write (long al_handle, readonly long pstm);//===================================================================
// Function:   nvo_comctl_imagelist::of_Write()
//-------------------------------------------------------------------
// Description:The ImageList_Write function writes an image list to a stream.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// pstm
//    Pointer to the stream. 
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   RETURN ImageList_Write(al_handle, pstm )
ELSE
   RETURN FALSE
END IF

end function

public function long of_duplicate (readonly long al_himl);RETURN Imagelist_Duplicate(al_himl)
end function

public function long of_icontobitmapfile (ref n_svc_mgr anv_svc, readonly long al_himl, readonly integer ai_index, readonly integer ai_size, readonly long al_backcolor, readonly string as_filename);RETURN of_icontobitmapfile(anv_svc, &
                           al_himl, &
                           ai_index, &
                           ai_size, &
                           al_backcolor, &
                           -1, & 
                           FALSE, &
                           0, &
                           FALSE, &
                           as_filename)
end function

public function boolean of_drawdisabled (ref n_svc_mgr anv_svc, long al_handle, readonly long i, readonly long hdcdst, readonly long cx, readonly long cy);//===================================================================
// Function:   nvo_comctl_imagelist::of_Draw()
//-------------------------------------------------------------------
// Description:The ImageList_Draw function draws an image list item 
//             in the specified device context.
//-------------------------------------------------------------------
// Parameters: 
//
// himl
//    Handle to the image list.
// i
//    Specifies the index of the image to draw.
// hdcDst
//    Handle to the destination device context.
// x 
//    Specifies the x-coordinate at which to draw within the specified device context.
// y
//    Specifies the y-coordinate at which to draw within the specified device context.
//-------------------------------------------------------------------
// Returns: If the function succeeds, the return value is TRUE.
//          If the function fails, the return value is FALSE.
//-------------------------------------------------------------------
// (c) 1997 Microsoft Corporation. All rights reserved.
//===================================================================

IF (al_handle > 0) THEN
   
   n_svc_system lnv_sys
   n_svc_bit lnv_bit
   
   anv_svc.of_LoadSvc(lnv_sys, CSvc.SYS)
   anv_svc.of_LoadSvc(lnv_bit, CSvc.BIT)
   
   IF lnv_sys.of_isxp() THEN
      n_svc_sizeof lnv_size
      imagelistdrawparams lstr
      
      anv_svc.of_LoadSvc(lnv_size, CSvc.SIZEOF)
      lstr.cbsize = lnv_size.sizeof(lstr)
      lstr.himl = al_handle
      lstr.i = i
      lstr.hdcdest = hdcdst
      lstr.rgbbk = CLR_NONE
      lstr.rgbfg = CLR_NONE
      lstr.fstate = ILS_SATURATE
      
      RETURN Imagelist_DrawIndirect(lstr)
   ELSE
      long ll_icon, ll_ret
      n_svc_win32 lnv_win32
      
      anv_svc.of_LoadSvc(lnv_win32, CSvc.WIN32)
      
      ll_icon = of_GetIcon(al_handle, i, 0)
      
      ll_ret = DrawState(hdcdst, 0, 0, ll_icon, 0, 0, 0, cx, cy, lnv_bit.of_BitwiseOR({DST_ICON, DSS_DISABLED}))
      
      lnv_win32.DestroyIcon(ll_icon)
      
      RETURN ll_ret <> 0
   END IF
ELSE
   RETURN FALSE
END IF
end function

public function long of_icontobitmapfile (ref n_svc_mgr anv_svc, readonly long al_himl, readonly integer ai_index, readonly integer ai_size, readonly long al_backcolor, readonly long al_backcolor2, readonly boolean ab_vertical, readonly integer ai_gradientoffset, readonly boolean ab_disabled, readonly string as_filename);ulong ll_desktop, ll_dc, ll_mem, ll_w, ll_h, ll_bmp, ll_icon, ll_tmpdc
long ll_ret
boolean lbb
n_svc_win32 lnv_win32
blob lb

anv_svc.of_loadsvc(lnv_win32, CSvc.WIN32)

//get icon width and height
ll_icon = this.of_Geticon(al_himl, ai_index, 0)
ll_w = ai_size
ll_h = ai_size

//create compatible DC from desktop
ll_desktop = lnv_win32.GetDesktopWindow()
ll_dc = lnv_win32.GetDC(ll_desktop)
ll_mem = lnv_win32.CreateCompatibleDC(ll_dc)
ll_tmpdc = lnv_win32.CreateCompatibleDC(ll_dc)
ll_bmp = lnv_win32.CreateCompatibleBitmap(ll_dc, ll_w, ll_h)

//draw icon on temp DC
ll_ret = lnv_win32.SelectObject(ll_tmpdc, ll_bmp)

IF al_backcolor2 = -1 THEN
   //solid color
   lbb = this.of_DrawEx(al_himl, ai_index, ll_tmpdc, 0, 0, 0, 0, al_backcolor, 0, 0)
ELSE
   //gradient
   n_svc_color lnv_color
   rect lrc
   
   lrc.left = 0
   lrc.top = 0
   lrc.right = ll_w
   lrc.bottom = ll_h
   
   IF ab_vertical THEN
      lrc.top -= ai_gradientoffset
      lrc.bottom += ai_gradientoffset
   ELSE
      lrc.left -= ai_gradientoffset
      lrc.right += ai_gradientoffset
   END IF
   
   anv_svc.of_LoadSvc(lnv_color, CSvc.COLOR)
   lnv_color.of_Drawgradient(ll_tmpdc, lrc, al_backcolor, al_backcolor2, ab_vertical)

   IF ab_disabled THEN
      lbb = this.of_Drawdisabled(anv_svc, al_himl, ai_index, ll_tmpdc, ll_w, ll_h)
   ELSE
      lbb = this.of_DrawEx(al_himl, ai_index, ll_tmpdc, 0, 0, 0, 0, CLR_NONE, 0, 0)
   END IF
END IF

//copy
ll_ret = lnv_win32.SelectObject(ll_mem, ll_bmp)
ll_ret = lnv_win32.Bitblt(ll_mem, 0, 0, ll_w, ll_h, ll_tmpdc, 0, 0, 13369376)

//create bitmap
long ll_pixels = 1

bitmapinfo lstr_Info
bitmapheader lstr_Header

lstr_Info.bmiheader.bisize=40

IF lnv_win32.GetDIBits(ll_mem, ll_bmp, 0, ll_h, 0, lstr_Info, 0) > 0 THEN
   IF lstr_Info.bmiheader.biBitCount = 16 OR &
         lstr_Info.bmiheader.biBitCount = 32 THEN
         ll_pixels = lstr_info.bmiheader.biwidth * lstr_info.bmiheader.biheight
   END IF
   
   lstr_Info.bmiColor[ll_pixels] = 0
      
   lb = blob(space(lstr_Info.bmiheader.bisizeimage), EncodingANSI!)

   //get the actual bits
   ll_ret = lnv_win32.GetDIBits(ll_mem, ll_bmp, 0, ll_h, lb, lstr_Info, 0) 
   
   // create a bitmap header
   lstr_Header.bfType[1] = CharA("B")
   lstr_Header.bfType[2] = CharA("M")
   lstr_Header.bfSize   = lstr_Info.bmiheader.bisizeimage
   lstr_Header.bfReserved1 = 0
   lstr_Header.bfReserved2 = 0
   lstr_Header.bfOffBits = 54 + (ll_pixels * 4)
   
   // copy the header structure to a blob
   blob lbl_header
   lbl_header = blob(space(14), EncodingANSI!)
   lnv_win32.CopyBitmapFileHeader(lbl_header, lstr_Header, 14 )

   // copy the info structure to a blob
   blob lbl_info
   lbl_Info = blob(space(40  + ll_pixels * 4), EncodingANSI!)
   lnv_win32.CopyBitmapInfo(lbl_Info, lstr_Info, 40 + ll_pixels * 4 )
   
   //add all together and we have a window bitmap in a blob
   lb = lbl_header + lbl_info + lb  
END IF

//clean-up
lnv_win32.DeleteDC(ll_mem)
lnv_win32.DeleteDC(ll_tmpdc)
lnv_win32.ReleaseDC(ll_desktop, ll_dc)
lnv_win32.DeleteObject(ll_bmp)
lnv_win32.DestroyIcon(ll_icon)

//write to disk
n_svc_files lnv_files

anv_svc.of_loadsvc(lnv_files, CSvc.FILES)

lnv_files.of_filewrite(anv_svc, as_filename, lb)

RETURN CRet.SUCCESS
end function

on n_svc_imagelist.create
call super::create
end on

on n_svc_imagelist.destroy
call super::destroy
end on

event destructor;//this.of_destroy()
end event