ReactOS
0.4.16-dev-336-gb667d82
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
15
DisplayImageList
(
HWND
hwnd
,
16
UINT
uID)
17
{
18
HWND
hLV;
19
SP_CLASSIMAGELIST_DATA
ImageListData
;
20
LV_ITEM
lvItem;
21
TCHAR
Buf[6];
22
INT
ImageListCount = -1;
23
INT
i
= 0;
24
25
hLV =
GetDlgItem
(
hwnd
,
IDC_LSTVIEW
);
26
(
void
)
ListView_DeleteAllItems
(hLV);
27
28
if
(uID ==
IDC_SYSTEM
)
29
{
30
HIMAGELIST
hLarge, hSmall;
31
HMODULE
hShell32
;
32
SH_GIL_PROC
Shell_GetImageLists
;
33
FII_PROC
FileIconInit
;
34
35
hShell32
=
LoadLibrary
(
_T
(
"shell32.dll"
));
36
if
(
hShell32
==
NULL
)
37
return
FALSE
;
38
39
Shell_GetImageLists
= (
SH_GIL_PROC
)
GetProcAddress
(
hShell32
, (
LPCSTR
)71);
40
FileIconInit
= (
FII_PROC
)
GetProcAddress
(
hShell32
, (
LPCSTR
)660);
41
42
if
(
Shell_GetImageLists
==
NULL
||
FileIconInit
==
NULL
)
43
{
44
FreeLibrary
(
hShell32
);
45
return
FALSE
;
46
}
47
48
FileIconInit
(
TRUE
);
49
50
Shell_GetImageLists
(&hLarge, &hSmall);
51
52
ImageListCount =
ImageList_GetImageCount
(hSmall);
53
54
(
void
)
ListView_SetImageList
(hLV,
55
hSmall,
56
LVSIL_SMALL
);
57
58
FreeLibrary
(
hShell32
);
59
}
60
else
if
(uID ==
IDC_DEVICE
)
61
{
62
ImageListData
.
cbSize
=
sizeof
(
SP_CLASSIMAGELIST_DATA
);
63
SetupDiGetClassImageList
(&
ImageListData
);
64
65
ImageListCount =
ImageList_GetImageCount
(
ImageListData
.
ImageList
);
66
67
(
void
)
ListView_SetImageList
(hLV,
68
ImageListData
.
ImageList
,
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
INT_PTR
CALLBACK
92
DlgProc
(
HWND
hwnd
,
93
UINT
message
,
94
WPARAM
wParam
,
95
LPARAM
lParam
)
96
{
97
switch
(
message
)
98
{
99
case
WM_INITDIALOG
:
100
DisplayImageList
(
hwnd
,
IDC_SYSTEM
);
101
return
TRUE
;
102
103
case
WM_CLOSE
:
104
EndDialog
(
hwnd
, 0);
105
return
TRUE
;
106
107
case
WM_COMMAND
:
108
{
109
switch
(
LOWORD
(
wParam
))
110
{
111
case
IDOK
:
112
EndDialog
(
hwnd
, 0);
113
return
TRUE
;
114
115
case
IDC_SYSTEM
:
116
DisplayImageList
(
hwnd
,
IDC_SYSTEM
);
117
return
TRUE
;
118
119
case
IDC_DEVICE
:
120
DisplayImageList
(
hwnd
,
IDC_DEVICE
);
121
return
TRUE
;
122
}
123
}
124
}
125
126
return
FALSE
;
127
}
128
129
int
WINAPI
130
WinMain
(
HINSTANCE
hThisInstance,
131
HINSTANCE
hPrevInstance,
132
LPSTR
lpszArgument,
133
int
nCmdShow)
134
{
135
INITCOMMONCONTROLSEX
icex;
136
137
icex.
dwSize
=
sizeof
(
INITCOMMONCONTROLSEX
);
138
icex.
dwICC
=
ICC_BAR_CLASSES
|
ICC_COOL_CLASSES
;
139
InitCommonControlsEx
(&icex);
140
141
return
DialogBox
(hThisInstance,
142
MAKEINTRESOURCE
(
IDD_IMGLST
),
143
NULL
,
144
DlgProc
);
145
}
WinMain
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow)
Definition:
main.c:8
wParam
WPARAM wParam
Definition:
combotst.c:138
lParam
LPARAM lParam
Definition:
combotst.c:139
InitCommonControlsEx
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition:
commctrl.c:900
DlgProc
DLGPROC DlgProc
Definition:
desk.c:122
NULL
#define NULL
Definition:
types.h:112
TRUE
#define TRUE
Definition:
types.h:120
FALSE
#define FALSE
Definition:
types.h:117
IDC_SYSTEM
#define IDC_SYSTEM
Definition:
resource.h:270
ImageList_GetImageCount
INT WINAPI ImageList_GetImageCount(HIMAGELIST himl)
Definition:
imagelist.c:2063
GetProcAddress
#define GetProcAddress(x, y)
Definition:
compat.h:753
FreeLibrary
#define FreeLibrary(x)
Definition:
compat.h:748
CALLBACK
#define CALLBACK
Definition:
compat.h:35
IDC_DEVICE
#define IDC_DEVICE
Definition:
resource.h:8
SetupDiGetClassImageList
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition:
devclass.c:322
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
i
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
ImageListData
SP_CLASSIMAGELIST_DATA ImageListData
Definition:
hdwwiz.c:34
Shell_GetImageLists
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition:
iconcache.cpp:683
_itot
#define _itot
Definition:
tchar.h:608
void
Definition:
nsiface.idl:2307
SH_GIL_PROC
BOOL(WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall)
Definition:
main.c:7
FII_PROC
BOOL(WINAPI * FII_PROC)(BOOL fFullInit)
Definition:
main.c:8
DisplayImageList
BOOL DisplayImageList(HWND hwnd, UINT uID)
Definition:
main.c:15
IDC_LSTVIEW
#define IDC_LSTVIEW
Definition:
resource.h:2
IDD_IMGLST
#define IDD_IMGLST
Definition:
resource.h:1
hShell32
static HMODULE hShell32
Definition:
string.c:34
UINT
unsigned int UINT
Definition:
ndis.h:50
BOOL
#define BOOL
Definition:
nt_native.h:43
LOWORD
#define LOWORD(l)
Definition:
pedump.c:82
LVSIL_SMALL
#define LVSIL_SMALL
Definition:
commctrl.h:2304
ListView_InsertItem
#define ListView_InsertItem(hwnd, pitem)
Definition:
commctrl.h:2413
INITCOMMONCONTROLSEX
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
ListView_SetImageList
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition:
commctrl.h:2309
LV_ITEM
#define LV_ITEM
Definition:
commctrl.h:2342
ListView_DeleteAllItems
#define ListView_DeleteAllItems(hwnd)
Definition:
commctrl.h:2419
LVIF_TEXT
#define LVIF_TEXT
Definition:
commctrl.h:2314
ICC_COOL_CLASSES
#define ICC_COOL_CLASSES
Definition:
commctrl.h:69
LVIF_IMAGE
#define LVIF_IMAGE
Definition:
commctrl.h:2315
ICC_BAR_CLASSES
#define ICC_BAR_CLASSES
Definition:
commctrl.h:60
setupapi.h
SP_CLASSIMAGELIST_DATA
struct _SP_CLASSIMAGELIST_DATA SP_CLASSIMAGELIST_DATA
FileIconInit
BOOL WINAPI FileIconInit(BOOL bFullInit)
Definition:
shellord.c:1888
_IMAGELIST
Definition:
imagelist.c:84
_SP_CLASSIMAGELIST_DATA
Definition:
setupapi.h:1095
_SP_CLASSIMAGELIST_DATA::cbSize
DWORD cbSize
Definition:
setupapi.h:1096
_SP_CLASSIMAGELIST_DATA::ImageList
HIMAGELIST ImageList
Definition:
setupapi.h:1097
message
Definition:
tftpd.h:60
tagINITCOMMONCONTROLSEX
Definition:
commctrl.h:54
tagINITCOMMONCONTROLSEX::dwICC
DWORD dwICC
Definition:
commctrl.h:56
tagINITCOMMONCONTROLSEX::dwSize
DWORD dwSize
Definition:
commctrl.h:55
INT_PTR
int32_t INT_PTR
Definition:
typedefs.h:64
INT
int32_t INT
Definition:
typedefs.h:58
_T
#define _T(x)
Definition:
vfdio.h:22
resource.h
LoadLibrary
#define LoadLibrary
Definition:
winbase.h:3887
hwnd
_In_ LONG _In_ HWND hwnd
Definition:
winddi.h:4023
LPARAM
LONG_PTR LPARAM
Definition:
windef.h:208
WPARAM
UINT_PTR WPARAM
Definition:
windef.h:207
WINAPI
#define WINAPI
Definition:
msvc.h:6
WM_CLOSE
#define WM_CLOSE
Definition:
winuser.h:1624
WM_COMMAND
#define WM_COMMAND
Definition:
winuser.h:1743
WM_INITDIALOG
#define WM_INITDIALOG
Definition:
winuser.h:1742
GetDlgItem
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
IDOK
#define IDOK
Definition:
winuser.h:833
MAKEINTRESOURCE
#define MAKEINTRESOURCE
Definition:
winuser.h:591
DialogBox
#define DialogBox
Definition:
winuser.h:5773
EndDialog
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
TCHAR
char TCHAR
Definition:
xmlstorage.h:189
LPCSTR
const char * LPCSTR
Definition:
xmlstorage.h:183
LPSTR
char * LPSTR
Definition:
xmlstorage.h:182
modules
rostests
tests
Imagelistviewer
main.c
Generated on Tue Dec 10 2024 06:15:15 for ReactOS by
1.9.6