uLib  User mode C/C++ extended API library for Win32 programmers.
SysImgList.h
Go to the documentation of this file.
1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 // Project: uLib - User mode library.
3 // Module: Access the system image lists (the hard-core way).
4 // Author: Copyright (c) Love Nystrom
5 // License: NNOSL (BSD descendant, see NNOSL.txt in the base directory).
6 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 
8 #ifndef __SysImglist_h_incl__
9 #define __SysImglist_h_incl__
10 
11 #include <uLib/Common.h>
12 #include <uLib/UtilFunc.h>
13 
18 
20 #define SYSIMG_USE_COMIFACE 0 // Allow use of IImageList ?
21 #if SYSIMG_USE_COMIFACE
22  #define _WIN32_IE 0x0600 // Need this to use IImageList
23  #define NTDDI_VERSION NTDDI_WINXP // Need this to use IImageList
24  #include <ShellApi.h> // Need this to use IImageList
25  #include <CommonControls.h> // Need this to use IImageList
26 #endif
27 
31 
32 enum eSysImg
33 {
50  siPrinter,
57  // Dynamic entries follow...
58 };
59 
60 #ifndef I_NOIMAGE
61  #define I_NOIMAGE (I_IMAGECALLBACK-1)
62 #endif
63 
71 
72 class SysImgList {
73 public:
74  static HIMAGELIST hSmall;
75  static HIMAGELIST hLarge;
76 
77  SHFILEINFO Info;
78 
79  SysImgList();
80 
81  UINT Count();
82  HICON GetSmallIcon( UINT Ix );
83  HICON GetLargeIcon( UINT Ix );
84 
85  // Note: hSmall and hLarge seem to have different associative indices
86  // past the initial fixed shell32 part of the lists .. Go figure.
87  // Hence the 'Small' parameter.
88 
91 
92  int GetFiletypeIconIndex( CSTR dotExt, bool Small );
93 
96 
97  int GetFileIconIndex( CSTR FName, bool Small );
98 
102 
103  #if !defined(__DOXYGEN__)
104  static BOOL (WINAPI *FileIconInit)( BOOL bFullInit ); // @660
105  static BOOL (WINAPI *Shell_GetImageLists)( HIMAGELIST* pimlLarge, HIMAGELIST* pimSmall ); // @71
106  #else // doxygen can't parse the plain function pointers..
107  static BOOL WINAPI FileIconInit( BOOL bFullInit ); // @660
109  static BOOL WINAPI Shell_GetImageLists( HIMAGELIST* pimlLarge, HIMAGELIST* pimSmall ); // @71
110  #endif
111 
112  bool ReplaceIcon( UINT Ix, HINSTANCE hInst, CSTR Id );
113  int AddIcon( HINSTANCE hInst, CSTR Id );
114 
115 protected:
116  static HMODULE _hShell32;
117 };
118 
120 #endif//ndef __SysImglist_h_incl__
121 // EOF
static HIMAGELIST hSmall
Definition: SysImgList.h:74
The world.
Definition: SysImgList.h:47
Any document.
Definition: SysImgList.h:34
#define CSTR
Definition: Common.h:329
Closed folder.
Definition: SysImgList.h:37
The cable.
Definition: SysImgList.h:48
static BOOL WINAPI Shell_GetImageLists(HIMAGELIST *pimlLarge, HIMAGELIST *pimSmall)
Network drive (offline).
Definition: SysImgList.h:44
3.5" floppy drive.
Definition: SysImgList.h:40
Optical drive.
Definition: SysImgList.h:45
Formatted document.
Definition: SysImgList.h:35
eSysImg
Definition: SysImgList.h:32
HIMAGELIST * pimSmall
Definition: SysImgList.cpp:21
int GetFiletypeIconIndex(CSTR dotExt, bool Small)
Definition: SysImgList.cpp:76
RAM drive.
Definition: SysImgList.h:46
static HMODULE _hShell32
Definition: SysImgList.h:116
HICON GetLargeIcon(UINT Ix)
Definition: SysImgList.cpp:71
BOOL(WINAPI *SysImgList::Shell_GetImageLists)(HIMAGELIST *pimlLarge
Executable file.
Definition: SysImgList.h:36
SHFILEINFO Info
Definition: SysImgList.h:77
Tape drive.
Definition: SysImgList.h:41
static BOOL WINAPI FileIconInit(BOOL bFullInit)
The local network.
Definition: SysImgList.h:56
UINT Count()
Definition: SysImgList.cpp:60
int AddIcon(HINSTANCE hInst, CSTR Id)
Definition: SysImgList.cpp:115
Network drive.
Definition: SysImgList.h:43
bool ReplaceIcon(UINT Ix, HINSTANCE hInst, CSTR Id)
Definition: SysImgList.cpp:101
A printer.
Definition: SysImgList.h:54
int GetFileIconIndex(CSTR FName, bool Small)
Definition: SysImgList.cpp:91
5.25" floppy drive.
Definition: SysImgList.h:39
Common include; Added types, small "ubiquitous" utilities, et c.
Harddisk drive.
Definition: SysImgList.h:42
HICON GetSmallIcon(UINT Ix)
Definition: SysImgList.cpp:66
Open folder.
Definition: SysImgList.h:38
static HIMAGELIST hLarge
Definition: SysImgList.h:75
The wide-area net.
Definition: SysImgList.h:55