- Add missing svn:eol-style properties.

- Use consistent newline style.
- Update file COPYING.

svn path=/trunk/; revision=43817
This commit is contained in:
Dmitry Gorbachev 2009-10-28 20:13:23 +00:00
parent 008b7c72d8
commit c9c4571300
13 changed files with 803 additions and 804 deletions

View file

@ -1,9 +1,9 @@
<module name="Imagelistviewer" type="win32gui" installbase="bin" installname="Imagelistviewer.exe">
<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>
<module name="Imagelistviewer" type="win32gui" installbase="bin" installname="Imagelistviewer.exe">
<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>

View file

@ -1,146 +1,146 @@
#include <windows.h>
#include <setupapi.h>
#include <tchar.h>
#include <stdlib.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);
}
#include <windows.h>
#include <setupapi.h>
#include <tchar.h>
#include <stdlib.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);
}

View file

@ -1,4 +1,4 @@
#define IDD_IMGLST 1000
#define IDC_LSTVIEW 1001
#define IDC_SYSTEM 1002
#define IDC_DEVICE 1003
#define IDD_IMGLST 1000
#define IDC_LSTVIEW 1001
#define IDC_SYSTEM 1002
#define IDC_DEVICE 1003

View file

@ -1,33 +1,33 @@
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
int main()
{
TCHAR Buffer = 0;
DWORD Count = 0;
//
// We clear the mode, most importantly turn off ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT
// This is the same mode as that is set up by getch() when trying to get a char
//
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),0);
//
// We read one char from the input and then return
//
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&Buffer,1,&Count,NULL);
//
// We print out this char as an int to show that infact a backspace does count as input
//
_tprintf(TEXT("You printed %c :: "), Buffer);
_tprintf(TEXT("With a value %d :: "), Buffer);
_tprintf(TEXT("Number of chars recieved %lu :: "), Count);
_tprintf(TEXT("Char equal to backspace %d \n"), (Buffer == TEXT('\b')));
//
// :)
//
return 0;
}
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
int main()
{
TCHAR Buffer = 0;
DWORD Count = 0;
//
// We clear the mode, most importantly turn off ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT
// This is the same mode as that is set up by getch() when trying to get a char
//
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),0);
//
// We read one char from the input and then return
//
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&Buffer,1,&Count,NULL);
//
// We print out this char as an int to show that infact a backspace does count as input
//
_tprintf(TEXT("You printed %c :: "), Buffer);
_tprintf(TEXT("With a value %d :: "), Buffer);
_tprintf(TEXT("Number of chars recieved %lu :: "), Count);
_tprintf(TEXT("Char equal to backspace %d \n"), (Buffer == TEXT('\b')));
//
// :)
//
return 0;
}