![]() |
|
|
Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
Опции темы | Поиск в этой теме | Опции просмотра |
#1
|
|||
|
|||
![]() Как получить стандартную иконку из Windows, вставить ее в ImageList, который привязан в ListView?
Т.е. я хочу получить список компьютеров в сети и отобразить список с теми же иконками что и в Windows. |
#2
|
||||
|
||||
![]() Код:
uses ShellAPI, procedure var icn: TIcon; begin icn:=TIcon.Create; icn.Handle:=ExtractIcon(HInstance, 'c:\windows\system32\shell32.dll', 15); Application.Icon.Assign(icn); ImageList1.AddIcon(icn); icn.Free; end; Последний раз редактировалось NumLock, 06.09.2010 в 10:41. |
#3
|
|||
|
|||
![]() Спасибо, работает.
А как сделать что бы путь до папки windows брался из системы? Вдруг windows не в C:\windows стоит? |
#4
|
||||
|
||||
![]() Можно так:
Код:
Var WinDir: PAnsiChar; begin GetMem(WinDir, 255); GetWindowsDirectory(WinDir, 255); Жизнь такова какова она есть и больше никакова. Помогаю за спасибо. |
#5
|
|||
|
|||
![]() Delphi 2010.
Делаю так: Код:
procedure TFindComputerForm.FormCreate(Sender: TObject); var icn: TIcon; WinDir: PAnsiChar; begin GetMem(WinDir, 255); GetWindowsDirectory(WinDir, 255); // Get standart image "computer" icn:=TIcon.Create; icn.Handle:=ExtractIcon(HInstance, WinDir+'\system32\shell32.dll', 15); ImageList1.AddIcon(icn); icn.Free; end; Ругается на: Код:
GetWindowsDirectory(WinDir, 255); [DCC Error] FindComputerNetworkUnit.pas(90): E2010 Incompatible types: 'AnsiChar' and 'Char' и icn.Handle:=ExtractIcon(HInstance, WinDir+'\system32\shell32.dll', 15); [DCC Error] FindComputerNetworkUnit.pas(93): E2010 Incompatible types: 'string' and 'PWideChar' |
#6
|
|||
|
|||
![]() Код:
var icn: TIcon; WinDir: PChar; begin GetMem(WinDir, 255); GetWindowsDirectory(WinDir, 255); // Get standart image "computer" icn:=TIcon.Create; icn.Handle:=ExtractIcon(HInstance, PChar(WinDir+'\system32\shell32.dll'), 15); ImageList1.AddIcon(icn); icn.Free; end; |
#7
|
|||
|
|||
![]() Да. Всё отлично работает. Спасибо.
|