ReactOS  0.4.13-dev-544-gede3fdd
main.c
Go to the documentation of this file.
1 #include <windows.h>
2 #include <setupapi.h>
3 #include <tchar.h>
4 #include <stdlib.h>
5 #include "resource.h"
6 
7 typedef BOOL (WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall);
8 typedef BOOL (WINAPI * FII_PROC)(BOOL fFullInit);
9 
10 /*** Shell32 undoc'd functions ***/
11  /* Shell_GetImageLists @71 */
12  /* FileIconInit @660 */
13 
14 BOOL
16  UINT uID)
17 {
18  HWND hLV;
20  LV_ITEM lvItem;
21  TCHAR Buf[6];
22  INT ImageListCount = -1;
23  INT i = 0;
24 
25  hLV = GetDlgItem(hwnd, IDC_LSTVIEW);
27 
28  if (uID == IDC_SYSTEM)
29  {
30  HIMAGELIST hLarge, hSmall;
34 
35  hShell32 = LoadLibrary(_T("shell32.dll"));
36  if(hShell32 == NULL)
37  return FALSE;
38 
41 
43  {
45  return FALSE;
46  }
47 
49 
50  Shell_GetImageLists(&hLarge, &hSmall);
51 
52  ImageListCount = ImageList_GetImageCount(hSmall);
53 
55  hSmall,
56  LVSIL_SMALL);
57 
59  }
60  else if (uID == IDC_DEVICE)
61  {
64 
66 
69  LVSIL_SMALL);
70  }
71  else
72  return FALSE;
73 
74  lvItem.mask = LVIF_TEXT | LVIF_IMAGE;
75 
76  while (i <= ImageListCount)
77  {
78  lvItem.iItem = i;
79  lvItem.iSubItem = 0;
80  lvItem.pszText = _itot(i, Buf, 10);
81  lvItem.iImage = i;
82 
83  (void)ListView_InsertItem(hLV, &lvItem);
84 
85  i++;
86  }
87 
88  return TRUE;
89 }
90 
91 
94  UINT message,
95  WPARAM wParam,
96  LPARAM lParam)
97 {
98  switch (message)
99  {
100  case WM_INITDIALOG:
102  return TRUE;
103 
104  case WM_CLOSE:
105  EndDialog(hwnd, 0);
106  return TRUE;
107 
108  case WM_COMMAND:
109  {
110  switch(LOWORD(wParam))
111  {
112  case IDOK:
113  EndDialog(hwnd, 0);
114  return TRUE;
115 
116  case IDC_SYSTEM:
118  return TRUE;
119 
120  case IDC_DEVICE:
122  return TRUE;
123  }
124  }
125  }
126 
127  return FALSE;
128 }
129 
130 int WINAPI
131 WinMain(HINSTANCE hThisInstance,
132  HINSTANCE hPrevInstance,
133  LPSTR lpszArgument,
134  int nCmdShow)
135 {
137 
138  icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
140  InitCommonControlsEx(&icex);
141 
142  return DialogBox(hThisInstance,
144  NULL,
145  (DLGPROC)DlgProc);
146 }
#define IDC_DEVICE
Definition: resource.h:8
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition: imagelist.c:2004
#define IDC_LSTVIEW
Definition: resource.h:2
#define LV_ITEM
Definition: commctrl.h:2309
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVSIL_SMALL
Definition: commctrl.h:2271
#define LoadLibrary
Definition: winbase.h:3676
#define CALLBACK
Definition: compat.h:27
UINT_PTR WPARAM
Definition: windef.h:207
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2380
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:441
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define _itot
Definition: tchar.h:608
BOOL DisplayImageList(HWND hwnd, UINT uID)
Definition: main.c:15
#define LVIF_TEXT
Definition: commctrl.h:2281
#define DialogBox
Definition: winuser.h:5627
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ICC_COOL_CLASSES
Definition: commctrl.h:69
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2276
smooth NULL
Definition: ftsmooth.c:416
BOOL(WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall)
Definition: main.c:7
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL WINAPI FileIconInit(BOOL bFullInit)
Definition: shellord.c:1298
char TCHAR
Definition: xmlstorage.h:189
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:405
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1603
#define WINAPI
Definition: msvc.h:8
#define LVIF_IMAGE
Definition: commctrl.h:2282
static BOOL(WINAPI *pSnmpExtensionInit)(DWORD
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define IDC_SYSTEM
Definition: resource.h:270
#define IDD_IMGLST
Definition: resource.h:1
BOOL CALLBACK DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: main.c:93
#define WM_COMMAND
Definition: winuser.h:1716
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:706
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2849
unsigned int UINT
Definition: ndis.h:50
BOOL(WINAPI * FII_PROC)(BOOL fFullInit)
Definition: main.c:8
#define GetProcAddress(x, y)
Definition: compat.h:410
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
Definition: main.c:8
struct _SP_CLASSIMAGELIST_DATA SP_CLASSIMAGELIST_DATA
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static HMODULE hShell32
Definition: string.c:34
SP_CLASSIMAGELIST_DATA ImageListData
Definition: hdwwiz.c:34
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2386