How to use HIMAGELIST in TreeView?

  • Thread starter Thread starter Anand Choubey
  • Start date Start date
A

Anand Choubey

Hi

I am facing one problem .
I am having HIMAGELIST handle, which I get from SetupDiGetClassImageIndex
and SetupDiGetClassImageList.
How can I use HIMAGELIST in TreeView class?
Please let me know.
 
Anand,
I am facing one problem .
I am having HIMAGELIST handle, which I get from SetupDiGetClassImageIndex
and SetupDiGetClassImageList.
How can I use HIMAGELIST in TreeView class?

Personally I'd stick with a managed ImageList for the TreeView
control. You can always use ImageList_Copy to copy the images you need
from the native HIMAGELIST to the ImageList instance.


Mattias
 
Hi Matthias,

here is a on-the-fly written pinvoke signature for
the ImageList_Copy in the comctl32.dll for Anand:

[Flags]
public enum ImageListCopyFlags : uint
{
ILCF_MOVE = 0x00000000,
ILCF_SWAP = 0x00000001
}

[DllImport("comctl32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static bool ImageList_Copy(HandleRef himlDst,
HandleRef himlSrc,
Int32 iDst,
Int32 iSrc,
ImageListCopyFlags uFlags);

Correct me if am wrong on that signature and
interessting is, that it has no GetLastError
Option, i mean the Original C-Function could
not be asked for that to return the register value
with GetLastError(),...



Regards

Kerem

--
 
Sorry,

i see, i forget the extern modifier keyword. This is the right
signature:

[Flags]
public enum ImageListCopyFlags : uint
{
ILCF_MOVE = 0x00000000,
ILCF_SWAP = 0x00000001
}

[DllImport("comctl32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ImageList_Copy(HandleRef himlDst,
HandleRef himlSrc,
Int32 iDst,
Int32 iSrc,
ImageListCopyFlags uFlags);

Regards

Kerem



--
 
Back
Top