Всем здравствуйте!
Возник один вопрос...
Нужно получить иконку, связанную с расширением для размещения в TListView.
Прога пишется на Delphi.
В общем, мне без проблем удалось получить иконку с помощью функции ExtractIcon.
Но проблема в том, что иконка получается большая, 32x32.При размещении в ListView с ViewStyle:=vsReport иконка скалится до 16x16, что очень сильно искажает её. В связи с этим, собственно, вопрос: как можно получить сразу иконку 16x16, зная имя файла с иконкой и её индекс?
Как получить иконку 16x16 для типа файла?
Модераторы: Naeel Maqsudov, C_O_D_E
Ни что так не ограничивает фантазию программиста, как компилятор...
ExtractIconEx ?
The ExtractIconEx function creates an array of handles to large or small icons extracted
from the specified executable file, dynamic-link library (DLL), or icon file.
Сам не пробовал, но по описанию похоже на то, что нужно.
The ExtractIconEx function creates an array of handles to large or small icons extracted
from the specified executable file, dynamic-link library (DLL), or icon file.
Код: Выделить всё
UINT ExtractIconEx(
LPCTSTR lpszFile, // file name
int nIconIndex, // icon index
HICON *phiconLarge, // large icon array
HICON *phiconSmall, // small icon array
UINT nIcons // number of icons to extract
);
[b]Parameters[/b]
[i]lpszFile[/i]
[in] Pointer to a null-terminated string specifying the name of an executable file, DLL,
or icon file from which icons will be extracted.
[i]nIconIndex [/i]
[in] Specifies the zero-based index of the first icon to extract. For example, if this value
is zero, the function extracts the first icon in the specified file.
If this value is –1 and phIconLarge and phiconSmall are both NULL, the function returns the
total number of icons in the specified file. If the file is an executable file or DLL, the return
value is the number of RT_GROUP_ICON resources. If the file is an .ico file, the return
value is 1.
Windows 95/98/Me, Windows NT 4.0 and later: If this value is a negative number and either
phIconLarge or phiconSmall is not NULL, the function begins by extracting the icon whose
resource identifier is equal to the absolute value of nIconIndex. For example, use -3 to
extract the icon whose resource identifier is 3.
[i]phiconLarge[/i]
[out] Pointer to an array of icon handles that receives handles to the large icons extracted
from the file. If this parameter is NULL, no large icons are extracted from the file.
[i]phiconSmall[/i]
[out] Pointer to an array of icon handles that receives handles to the small icons extracted
from the file. If this parameter is NULL, no small icons are extracted from the file.
[i]nIcons[/i]
[in] Specifies the number of icons to extract from the file.
BBB, спасибо, то что надо.
Никак не приучусь пользоваться MSDN
Никак не приучусь пользоваться MSDN
Ни что так не ограничивает фантазию программиста, как компилятор...
-
- Сообщения: 0
- Зарегистрирован: 12 окт 2015, 04:09
- Откуда: Guam
- Контактная информация:
On our web, you can feel safe! Besides we use mirrored hard drives on all of our servers so we also take backup twice a day on separate servers. We use ISPmanager as the control panel. ISPmanager is a control panel that makes it easy to administer its Web site. With us you can place as many websites and domains you wish for a hosting account.
virtual hosting
virtual hosting