4 #include <stdlib.h> // FIXME-DONTCOMMIT: Why is this needed?
7 typedef BOOL (WINAPI
* SH_GIL_PROC
)(HIMAGELIST
*phLarge
, HIMAGELIST
*phSmall
);
8 typedef BOOL (WINAPI
* FII_PROC
)(BOOL fFullInit
);
10 /*** Shell32 undoc'd functions ***/
11 /* Shell_GetImageLists @71 */
12 /* FileIconInit @660 */
15 DisplayImageList(HWND hwnd
,
19 SP_CLASSIMAGELIST_DATA ImageListData
;
22 INT ImageListCount
= -1;
25 hLV
= GetDlgItem(hwnd
, IDC_LSTVIEW
);
26 (void)ListView_DeleteAllItems(hLV
);
28 if (uID
== IDC_SYSTEM
)
30 HIMAGELIST hLarge
, hSmall
;
32 SH_GIL_PROC Shell_GetImageLists
;
33 FII_PROC FileIconInit
;
35 hShell32
= LoadLibrary(_T("shell32.dll"));
39 Shell_GetImageLists
= (SH_GIL_PROC
)GetProcAddress(hShell32
, (LPCSTR
)71);
40 FileIconInit
= (FII_PROC
)GetProcAddress(hShell32
, (LPCSTR
)660);
42 if(Shell_GetImageLists
== NULL
|| FileIconInit
== NULL
)
44 FreeLibrary(hShell32
);
50 Shell_GetImageLists(&hLarge
, &hSmall
);
52 ImageListCount
= ImageList_GetImageCount(hSmall
);
54 (void)ListView_SetImageList(hLV
,
58 FreeLibrary(hShell32
);
60 else if (uID
== IDC_DEVICE
)
62 ImageListData
.cbSize
= sizeof(SP_CLASSIMAGELIST_DATA
);
63 SetupDiGetClassImageList(&ImageListData
);
65 ImageListCount
= ImageList_GetImageCount(ImageListData
.ImageList
);
67 (void)ListView_SetImageList(hLV
,
68 ImageListData
.ImageList
,
74 lvItem
.mask
= LVIF_TEXT
| LVIF_IMAGE
;
76 while (i
<= ImageListCount
)
80 lvItem
.pszText
= _itot(i
, Buf
, 10);
83 (void)ListView_InsertItem(hLV
, &lvItem
);
101 DisplayImageList(hwnd
, IDC_SYSTEM
);
110 switch(LOWORD(wParam
))
117 DisplayImageList(hwnd
, IDC_SYSTEM
);
121 DisplayImageList(hwnd
, IDC_DEVICE
);
131 WinMain(HINSTANCE hThisInstance
,
132 HINSTANCE hPrevInstance
,
136 INITCOMMONCONTROLSEX icex
;
138 icex
.dwSize
= sizeof(INITCOMMONCONTROLSEX
);
139 icex
.dwICC
= ICC_BAR_CLASSES
| ICC_COOL_CLASSES
;
140 InitCommonControlsEx(&icex
);
142 return DialogBox(hThisInstance
,
143 MAKEINTRESOURCE(IDD_IMGLST
),