![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
|
|
#1
|
|||
|
|||
|
Есть такая проблема: надо поместить компонент в dll - например ImageList. При нажатие на кнопку в приложении динамически загрузить dll в память, взять оттуда ImageList и назначить его например главному меню приложения. В интернете нигде нету информации, как такое делать...
![]() Буду очень благодарен за помощь... Последний раз редактировалось s0manmbula, 06.11.2009 в 17:50. |
|
#2
|
||||
|
||||
|
Цитата:
|
|
#3
|
|||
|
|||
|
Цитата:
Уже исправил - компонент ImageList... ![]() |
|
#4
|
||||
|
||||
|
Цитата:
Код:
function GetImageList: Pointer; var ilImages: TImageList; begin ilImages := TImageList.Create(nil); // ... Result := @ilImages; //нужный TImageList end; Код:
procedure GetImages;
type
TGetImageListProc = function: Pointer;
const
libname = 'mylib.dll';
procName = 'GetImageList';
var
lib: Cardinal;
proc: TGetImageListProc;
newImages: TImageList;
begin
lib := LoadLibrary(pchar(libname));
if(lib<>-1)then
begin
proc := GetProcAddress(lib,procName);
if(proc<>nil)then
newImages := proc^;
end;
end; |
|
#5
|
|||
|
|||
|
Цитата:
Код:
newImages := proc^; [DCC Error] Unit1.pas(210): E2010 Incompatible types: 'TImageList' and 'procedure, untyped pointer or untyped parameter' |
|
#6
|
||||
|
||||
|
тогда так:
Код:
function GetImageList: Pointer; var ilImages: TImageList; begin ilImages := TImageList.Create(nil); // ... Result := @ilImages; //нужный TImageList end; Код:
Код:
procedure GetImages;
type
PImageList = ^TImageList;
TGetImageListProc = function: PImageList;
const
libname = 'mylib.dll';
procName = 'GetImageList';
var
lib: Cardinal;
proc: TGetImageListProc;
newImages: TImageList;
begin
lib := LoadLibrary(pchar(libname));
if(lib<>-1)then
begin
proc := GetProcAddress(lib,procName);
if(proc<>nil)then
newImages := proc^;
end;
end; |