mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 17:56:06 +00:00
- test app to display both the system and device image lists.
- this app confirms the overlay icons in the device image list are part of the list. svn path=/trunk/; revision=24573
This commit is contained in:
parent
aef24e2a4a
commit
41ba900587
5 changed files with 178 additions and 0 deletions
12
rosapps/tests/Imagelistviewer/imagelistviewer.rbuild
Normal file
12
rosapps/tests/Imagelistviewer/imagelistviewer.rbuild
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<module name="imagelistviewer" type="win32gui" installbase="bin" installname="imagelistviewer.exe">
|
||||||
|
<define name="_WIN32_IE">0x0501</define>
|
||||||
|
<define name="_WIN32_WINNT">0x0501</define>
|
||||||
|
<define name="__USE_W32API" />
|
||||||
|
<include base="imagelistviewer">.</include>
|
||||||
|
<library>kernel32</library>
|
||||||
|
<library>user32</library>
|
||||||
|
<library>setupapi</library>
|
||||||
|
<library>comctl32</library>
|
||||||
|
<file>main.c</file>
|
||||||
|
<file>res.rc</file>
|
||||||
|
</module>
|
145
rosapps/tests/Imagelistviewer/main.c
Normal file
145
rosapps/tests/Imagelistviewer/main.c
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <setupapi.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall);
|
||||||
|
typedef BOOL (WINAPI * FII_PROC)(BOOL fFullInit);
|
||||||
|
|
||||||
|
/*** Shell32 undoc'd functions ***/
|
||||||
|
/* Shell_GetImageLists @71 */
|
||||||
|
/* FileIconInit @660 */
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
DisplayImageList(HWND hwnd,
|
||||||
|
UINT uID)
|
||||||
|
{
|
||||||
|
HWND hLV;
|
||||||
|
SP_CLASSIMAGELIST_DATA ImageListData;
|
||||||
|
LV_ITEM lvItem;
|
||||||
|
TCHAR Buf[6];
|
||||||
|
INT ImageListCount = -1;
|
||||||
|
INT i = 0;
|
||||||
|
|
||||||
|
hLV = GetDlgItem(hwnd, IDC_LSTVIEW);
|
||||||
|
(void)ListView_DeleteAllItems(hLV);
|
||||||
|
|
||||||
|
if (uID == IDC_SYSTEM)
|
||||||
|
{
|
||||||
|
HIMAGELIST hLarge, hSmall;
|
||||||
|
HMODULE hShell32;
|
||||||
|
SH_GIL_PROC Shell_GetImageLists;
|
||||||
|
FII_PROC FileIconInit;
|
||||||
|
|
||||||
|
hShell32 = LoadLibrary(_T("shell32.dll"));
|
||||||
|
if(hShell32 == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
Shell_GetImageLists = (SH_GIL_PROC)GetProcAddress(hShell32, (LPCSTR)71);
|
||||||
|
FileIconInit = (FII_PROC)GetProcAddress(hShell32, (LPCSTR)660);
|
||||||
|
|
||||||
|
if(Shell_GetImageLists == NULL || FileIconInit == NULL)
|
||||||
|
{
|
||||||
|
FreeLibrary(hShell32);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileIconInit(TRUE);
|
||||||
|
|
||||||
|
Shell_GetImageLists(&hLarge, &hSmall);
|
||||||
|
|
||||||
|
ImageListCount = ImageList_GetImageCount(hSmall);
|
||||||
|
|
||||||
|
(void)ListView_SetImageList(hLV,
|
||||||
|
hSmall,
|
||||||
|
LVSIL_SMALL);
|
||||||
|
|
||||||
|
FreeLibrary(hShell32);
|
||||||
|
}
|
||||||
|
else if (uID == IDC_DEVICE)
|
||||||
|
{
|
||||||
|
ImageListData.cbSize = sizeof(SP_CLASSIMAGELIST_DATA);
|
||||||
|
SetupDiGetClassImageList(&ImageListData);
|
||||||
|
|
||||||
|
ImageListCount = ImageList_GetImageCount(ImageListData.ImageList);
|
||||||
|
|
||||||
|
(void)ListView_SetImageList(hLV,
|
||||||
|
ImageListData.ImageList,
|
||||||
|
LVSIL_SMALL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
lvItem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||||
|
|
||||||
|
while (i <= ImageListCount)
|
||||||
|
{
|
||||||
|
lvItem.iItem = i;
|
||||||
|
lvItem.iSubItem = 0;
|
||||||
|
lvItem.pszText = _itot(i, Buf, 10);
|
||||||
|
lvItem.iImage = i;
|
||||||
|
|
||||||
|
(void)ListView_InsertItem(hLV, &lvItem);
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CALLBACK
|
||||||
|
DlgProc(HWND hwnd,
|
||||||
|
UINT message,
|
||||||
|
WPARAM wParam,
|
||||||
|
LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG:
|
||||||
|
DisplayImageList(hwnd, IDC_SYSTEM);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case WM_CLOSE:
|
||||||
|
EndDialog(hwnd, 0);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
switch(LOWORD(wParam))
|
||||||
|
{
|
||||||
|
case IDOK:
|
||||||
|
EndDialog(hwnd, 0);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDC_SYSTEM:
|
||||||
|
DisplayImageList(hwnd, IDC_SYSTEM);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case IDC_DEVICE:
|
||||||
|
DisplayImageList(hwnd, IDC_DEVICE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WINAPI
|
||||||
|
WinMain(HINSTANCE hThisInstance,
|
||||||
|
HINSTANCE hPrevInstance,
|
||||||
|
LPSTR lpszArgument,
|
||||||
|
int nCmdShow)
|
||||||
|
{
|
||||||
|
INITCOMMONCONTROLSEX icex;
|
||||||
|
|
||||||
|
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||||
|
icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
|
||||||
|
InitCommonControlsEx(&icex);
|
||||||
|
|
||||||
|
return DialogBox(hThisInstance,
|
||||||
|
MAKEINTRESOURCE(IDD_IMGLST),
|
||||||
|
NULL,
|
||||||
|
(DLGPROC)DlgProc);
|
||||||
|
}
|
14
rosapps/tests/Imagelistviewer/res.rc
Normal file
14
rosapps/tests/Imagelistviewer/res.rc
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
IDD_IMGLST DIALOGEX 6,6,303,216
|
||||||
|
CAPTION "Imagelist Viewer"
|
||||||
|
FONT 8, "MS Sans Serif", 0, 0
|
||||||
|
STYLE WS_BORDER | WS_VISIBLE | WS_SYSMENU
|
||||||
|
BEGIN
|
||||||
|
CONTROL "", IDC_LSTVIEW, "SysListView32", WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_LIST | LVS_SMALLICON | LVS_SHAREIMAGELISTS, 0, 0, 302, 200
|
||||||
|
DEFPUSHBUTTON "System IL", IDC_SYSTEM, 2, 202, 54, 13
|
||||||
|
PUSHBUTTON "Device IL", IDC_DEVICE, 60, 202, 54, 13
|
||||||
|
PUSHBUTTON "Close", IDOK, 248, 202, 54, 13
|
||||||
|
END
|
4
rosapps/tests/Imagelistviewer/resource.h
Normal file
4
rosapps/tests/Imagelistviewer/resource.h
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#define IDD_IMGLST 1000
|
||||||
|
#define IDC_LSTVIEW 1001
|
||||||
|
#define IDC_SYSTEM 1002
|
||||||
|
#define IDC_DEVICE 1003
|
|
@ -112,6 +112,9 @@
|
||||||
<directory name="icontest">
|
<directory name="icontest">
|
||||||
<xi:include href="icontest/icontest.rbuild" />
|
<xi:include href="icontest/icontest.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
<directory name="imagelistviewer">
|
||||||
|
<xi:include href="imagelistviewer/imagelistviewer.rbuild" />
|
||||||
|
</directory>
|
||||||
|
|
||||||
<!-- fixme: iptest -->
|
<!-- fixme: iptest -->
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue