🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #9231

Re: VCL components in DLL

#9231
From: Dennis Jones
Date: Mon, 19 Jul 2004 18:35
38 lines
1819 bytes
"Pere Mateu" <pmateu@siam.es> wrote in message
news:40fbfe0c$1@newsgroups.borland.com...
> Hi,
>
> I'm trying to embed some VCL components in a DLL. I want to show these
> components in the main form of my app by -after succesfully getting a
> pointer to the VCL component- changing the Parent property from the form
in
> the DLL to the form in the main EXE. But this is not working. I get
> assignment errors like 'Can not assign a TFont to a TFont'.
>
> What am I doing wrong?
> Thanks very much.
> Pere

You can do one of two things:

1) Use a package instead of a DLL, or
2) Set the DLL's 'Application->Handle' to the EXE's main form handle:

In the DLL:

namespace MyDLL
{
  void __stdcall InitAppData( HWND handle )
  {
    Application->Handle = handle;
  }
}

In the EXE:

MyDLL::InitAppData( Application->MainForm->Handle );

And of course, appropriately export the function from the DLL.

- Dennis
Technical Details
Message-ID: <40fc1456$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40fbfe0c$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a715283d5a51ae91
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@bogus.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40fbfe0c$1@newsgroups.borland.com>
Subject: Re: VCL components in DLL
Date: Mon, 19 Jul 2004 11:35:00 -0700
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 204.200.27.7
Message-ID: <40fc1456$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1090262102 204.200.27.7 (19 Jul 2004 11:35:02 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail