Re: Get Class ImageList

Tech-Archive recommends: Speed Up your PC by fixing your registry




"[Joe]" <Joe@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:158F3917-9C35-487F-8910-059C413331C4@xxxxxxxxxxxxxxxx
| Hi,
| How can I get the System class ImageList from C# application, I want to
| receive this image list used in device manager ?
| I find a C API :
|
| WINSETUPAPI BOOL WINAPI
| SetupDiGetClassImageList(
| OUT PSP_CLASSIMAGELIST_DATA ClassImageListData);
|
| How I can call this API from C# ?
|
| Thanks
| Joe

Not sure why you ever wanna use this from C# but here it goes:

[DllImport("setupapi.dll")]
static extern int SetupDiGetClassImageList(out PSP_CLASSIMAGE_DATA
ClassImageList);

public struct PSP_CLASSIMAGE_DATA {
public uint cbSize; // size of this struct
public IntPtr ImageList; // Handle
public uint Reserved;
}

don't forget to destroy the list when done (see
SetupDiDestroyClassImageList).

Willy.


.



Relevant Pages

  • Re: FTP FtpFindFile
    ... public struct WIN32_FIND_DATA ... public int fileAttributes; ... public FILETIME lastAccessTime; ... public uint fileAttributes; ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: 8 bit image
    ... > How do I instantiate an RGBQUAD? ... public struct BITMAPINFOHEADER ... public uint biCompression; ... BITMAPINFO bmi = new BITMAPINFO; ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Arrays in structures
    ... public uint dwFileAttributes; ... public FILETIME ftLastAccessTime; ... public string cAlternateFileName; ... public struct FILETIME ...
    (microsoft.public.dotnet.languages.csharp)
  • FieldOffset on 64bit OS
    ... public struct MOUSEINPUT ... public int dx; ... public uint mouseData; ... public ushort wScan; ...
    (microsoft.public.dotnet.languages.csharp)
  • Casting problem with C# DLL
    ... VB Function within windows app and windows service: ... public enum IFILTER_FLAGS ... public uint ulKind; ... public struct FULLPROPSPEC ...
    (microsoft.public.dotnet.languages.vb)