>>components, but is the public method you are declaring and calling to 
>> get the classname applicable to both your TFrameClass and 

Actually I do not want to retrieve classname, but the Class reference. I 
would like to make an application, which can show several (a lot) 
frames. I thought make a mainform in a project, and the lot of frames 
will be in a separated package, and -depending the action performed by 
the user- show the proper frame. (on mainform)
So I need to know the Class reference of the frame to create an 
instance from it. 
But to avoid the disturb effects, I made a more simply sample to produce 
this effect. (I have got NO any errors or exceptions)

now, the code of frame in the package looks like:

procedure GetFrameClass(prnt:TForm); stdcall;
var
  frame1:TFrame1;
begin
  frame1:=TFrame1.Create(prnt);  // only create and set parent
  frame1.Parent:=prnt;
end;

the mainform's code is:

procedure TForm1.Button1Click(Sender: TObject);
begin
  hnd:= LoadPackage('Package1.bpl');
  prc:=GetProcAddress(hnd,'GetFrameClass');
  if Assigned(prc) then
    prc(Form1);   // just call a create with the Owner Form1
 
 ---
 and the effect is the same. An invisible frame. 
An interesting addition: when I put the code after prc(Form1)

  cmp:= Form1.FindComponent('Frame1');
  if cmp<>nil then
    showmessage(inttostr(TFrame(cmp).Width));

I got a message about the width (320) of the invisible frame!
If I replace the message to TFrame(cmp).ClassName, the result is 
TFrame1 !!

It's unbelievable. 
Are there any idea?

m.

___________________________________________________________________________
"AZ ŐSKORBAN A HOMO SAPIENS 6-8 m2 ALAPTERÜLETŰ BARLANGBAN LAKOTT. A XXI.
SZÁZADBAN ÖNNEK MILYENEK AZ IGÉNYEI? "    http://www.realisingatlan.hu



__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to