Article View: borland.public.cppbuilder.nativeapi
Article #8417SendMessage, WM_COPYDATA, FindWindow and TApplication
From: Stefano Bonifazi
Date: Sat, 30 Oct 2004 10:44
Date: Sat, 30 Oct 2004 10:44
21 lines
2011 bytes
2011 bytes
Hi all!
The problem arised with the previous thread about communication between 2
applications of Mr. Christophe MINETTI:
U need to use SendMessage to send WM_COPYDATA messages instead of
PostMessage according to what MS stats!
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")).
Stopping here I can only send the message to the "application window"...
But the Application ->OnMessage event only allows me to handle message of
the queue sent with PostMessage!!
My workaround has been to use the EnumWindows functions to get the mainform
handle, then send the message to it and using the Form message handler (or
by overriding the WndProc, or by using BEGIN_MESSAGE_MAP ...
END_MESSAGE_MAP(TForm); ) in the receiver application...
My question are:
1)Is there a way to get SendMessage messages with the TApplication?
2)Is there a way to get the MainForm handle by using FindWindow?
Thank U in advance!
Stefano B.
Technical Details
Message-ID:
<4183708b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.wiretrip.org!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-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,42878f3b25dcd7e1,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Stefano Bonifazi" <stefboombastic@tele2.it> Newsgroups: borland.public.cppbuilder.nativeapi Subject: SendMessage, WM_COPYDATA, FindWindow and TApplication Date: Sat, 30 Oct 2004 12:44:26 +0200 Lines: 25 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 212.141.199.222 Message-ID: <4183708b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1099133067 212.141.199.222 (30 Oct 2004 03:44:27 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.wiretrip.org!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