🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: form inside a dll loaded by a console application

#2799
From: Stefano Bonifazi
Date: Wed, 27 Dec 2006 21:14
42 lines
2778 bytes
Thank U Mr. Lebeau!

Remy Lebeau (TeamB) wrote:
> Then you can't use a TForm (or any other type of window) in a console
> application.  A message queue is required in order for messages to work
> properly.  

Well it seems this time I get into something impossible to do :(

> If you want the DLL to run its own queue, then you should export a separate
> blocking function from the DLL that console applications call but GUI
> applications do not call.  If you don't want to implement the message queue
> manually, you could use TForm::ShowModal() to handle it for you.

Impossible the console application should continue its work in spite of 
what my form does ...

> If the console application already has an active message queue, then your
> TForm should have already been working from the very beginning.

No the console application has a loop that does other than processing 
windows messages.. low level stuff with high priority

> VCL windowed components (including TForm) do not work well in worker
> threads.  For the most part, the VCL is not thread-safe at all.  If you must
> use a window in a thread, then you should use the Win32 API directly
> instead.  

If I have to start coding all the windows in WinAPI the wonder of 
borland vanishes and I'd better use the MS VC++

And there must be a message queue in whatever thread is calling
> the DLL.  Messages can be received for a window only in the same thread that
> creates the window.

But if I create a window inside a thread spawned by the DLL, cannot 
those messages be received by the thread provided that window has its 
message queue?


Thank U again...
Stefano B.
Technical Details
Message-ID: <4592e225@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <458e4f48@newsgroups.borland.com> <45903d10$1@newsgroups.borland.com> <45919f15@newsgroups.borland.com> <4591c308$1@newsgroups.borland.com> <4592cf7c$1@newsgroups.borland.com> <4592dc17$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3fa2091e9808a898
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Wed, 27 Dec 2006 22:14:46 +0100
From: Stefano Bonifazi <stefboombastic@email.it>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: form inside a dll loaded by a console application
References: <458e4f48@newsgroups.borland.com> <45903d10$1@newsgroups.borland.com> <45919f15@newsgroups.borland.com> <4591c308$1@newsgroups.borland.com> <4592cf7c$1@newsgroups.borland.com> <4592dc17$1@newsgroups.borland.com>
In-Reply-To: <4592dc17$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 80.104.236.70
Message-ID: <4592e225@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1167254053 80.104.236.70 (27 Dec 2006 13:14:13 -0800)
Lines: 42
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail