🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.winforms.controls.using
Article #477

Re: Assembly

#477
From: Stefanidis Dimitris
Date: Thu, 14 Oct 2004 14:33
46 lines
2436 bytes
Thanks a lot  for your time.

Dimitris


"Marc Rohloff [TeamB]" <marcrohloff@nospam.invalid> wrote in message 
news:416d5a97$1@newsgroups.borland.com...
>
> "Marc Rohloff [TeamB]" <"on request"> wrote:
>>On Tue, 12 Oct 2004 11:29:29 +0300, Stefanidis Dimitris wrote:
>
> OK, I figured out the code to do what you are trying to do, but first the 
> disclaimners :)
> 1) This is stuff that is internal to the compiler. You can't assume that 
> it won't change between versions of Delphi.
>
> 2) If you do this you won't be able to use code written in c#. (Although 
> you could write code to check this and use the other alternative)
>
> The code is as follows:
>
> procedure TWinForm1.Button1_Click(sender: System.Object; e: 
> System.EventArgs);
> var
>   ass   : Assembly;
>   typ   : System.Type;
>   cltyp : System.Type;
>   meth  : MethodInfo;
>   cl    :TObject;
>   s     : string;
> begin
>  ass   := Assembly.LoadFrom('Package2.dll');
>  typ   := ass.GetType('WinForm.TWinForm2');
>  meth  := typ.GetMethod('Foo_Ex');
>  cltyp := typ.GetNestedType('@Meta' + typ.Name);
>  cl    := cltyp.GetField('@Instance').GetValue(nil);
>
>  s := meth.Invoke(nil, [cl, 'Something']) as string;
>  TextBox1.Text := s;
> end;
>
> -- 
> Marc Rohloff [TeamB]
> marc rohloff at myrealbox dot com
>
> 
Technical Details
Message-ID: <416e8e08@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <416a6b58@newsgroups.borland.com> <160pc6hq54s6u.dlg@marcrohloff.40tude.net> <416aab1c$1@newsgroups.borland.com> <193806g05jowf$.dlg@marcrohloff.40tude.net> <416b95b1$1@newsgroups.borland.com> <1fyq70lpmxmbo.dlg@marcrohloff.40tude.net> <416d5a97$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1eff29,f1ab105b74fcb56e
X-Google-Attributes: gid1eff29,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Stefanidis Dimitris" <distef01@yahoo.gr>
Newsgroups: borland.public.delphi.winforms.controls.using
References: <416a6b58@newsgroups.borland.com> <160pc6hq54s6u.dlg@marcrohloff.40tude.net> <416aab1c$1@newsgroups.borland.com> <193806g05jowf$.dlg@marcrohloff.40tude.net> <416b95b1$1@newsgroups.borland.com> <1fyq70lpmxmbo.dlg@marcrohloff.40tude.net> <416d5a97$1@newsgroups.borland.com>
Subject: Re: Assembly
Date: Thu, 14 Oct 2004 17:33:37 +0300
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 194.30.233.129
Message-ID: <416e8e08@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1097764360 194.30.233.129 (14 Oct 2004 07:32:40 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail