🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: SendMessage, WM_COPYDATA, FindWindow and TApplication

#8359
From: Ray
Date: Wed, 03 Nov 2004 15:17
39 lines
2591 bytes
Hi
If you have written both the sending and receiving applications, which will 
mostly be the case, then do as I do and launch the sender from the receiver 
with CreateProcess(). Then you can arrange the sender to have a command line 
into which you can put the Windows handle of the receiver. This way there is 
no ambiguity about the handle. Also the sender can be closed when you close 
the receiver.

Just a suggestion

Ray
"Stefano Bonifazi" <stefboombastic@tele2.it> wrote in message 
news:4183708b@newsgroups.borland.com...
> 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: <4188fa6d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!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: "Ray" <someone@someisp.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4183708b@newsgroups.borland.com>
Subject: Re: SendMessage,  WM_COPYDATA,  FindWindow and TApplication
Date: Wed, 3 Nov 2004 15:17:51 -0000
Lines: 41
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: 62.56.16.23
Message-ID: <4188fa6d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1099496045 62.56.16.23 (3 Nov 2004 07:34:05 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail