Sytuacja wygląda tak:
próbuję odwołać się w unit2 do procedury pochodzącej z klasy w unit1.
Problem polega na tym, że Delphi "nie widzi" tej klasy, dlatego nie idzie wywołać procedury.
Zamieszczam kod:
Unit1:
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, ShellAPI, MyImage1;
type
...
TJPEGRes = class(TJPEGImage)
public
procedure LoadFromResource(const ResID: PChar); virtual;
end;
...
Unit2:
unit Exam1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, ShellAPI, MyImage1;
type
TExam1Form = class(TForm)
IMGExam1Theme: TImage;
procedure LoadTheme;
end;
var
Exam1Form: TExam1Form;
implementation
uses Main;
{$R *.dfm}
{$R Resources.RES}
procedure TJPEGRes.LoadFromResource(const ResID: PChar);
var
Res : TResourceStream;
begin
Res := TResourceStream.Create(hInstance, ResID, 'JPEGFILE');
try
LoadFromStream(Res);
finally
Res.Free;
end;
end;
end.