🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: SendMessage, WM_COPYDATA, FindWindow and TApplication

#8419
From: Remy Lebeau (TeamB)
Date: Sat, 30 Oct 2004 18:14
37 lines
2368 bytes
"Stefano Bonifazi" <stefboombastic@tele2.it> wrote in message
news:4183708b@newsgroups.borland.com...

> By using FindWindow U can get the handle of the Borland TApplication (
> FindWindow("TApplication","MyProjectName")), but it fails if I try to get
> the mainform handle instead (FindWindow("TForm1","Form1")).

Then you are not using it correctly, because it works fine for me whenever I
use it.

> Stopping here I can only send the message to the "application window"...

Not true.  You can send messages to any window.

> But the Application ->OnMessage event only allows me to
> handle message of the queue sent with PostMessage!!

Correct.  For other messages, you will need to use
Application->HookMainWindow() instead.

> 1)Is there a way to get SendMessage messages with the TApplication?

See above.

> 2)Is there a way to get the MainForm handle by using FindWindow?

You already know how.  There is nothing wrong with using
FindWindow("TForm1", "Form1"), it works fine assuming those are your actual
values of your window.  I do strongly recommend that you give your forms
more unique names, though, to prevent FindWindow() from finding windows that
belong to other applications instead of your own, in case you are running
other VCL programs written by other people.  You should never stick with
using the default names for very long.


Gambit
Technical Details
Message-ID: <4183d9c2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4183708b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,42878f3b25dcd7e1
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4183708b@newsgroups.borland.com>
Subject: Re: SendMessage,  WM_COPYDATA,  FindWindow and TApplication
Date: Sat, 30 Oct 2004 11:14:23 -0700
Lines: 39
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: 68.69.17.41
Message-ID: <4183d9c2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099160002 68.69.17.41 (30 Oct 2004 11:13:22 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail