Article View: borland.public.cppbuilder.nativeapi
Article #1358Re: WM_COPYDATA problem
From: anon5
Date: Mon, 03 Sep 2007 08:46
Date: Mon, 03 Sep 2007 08:46
40 lines
2258 bytes
2258 bytes
Ok my app is now working correctly, many thanks.
I now have another problem however. The call to FindWindow() to get the
form's handle relies on the form's caption being a predefined value.
What if I want to change the caption at runtime? Is there any way around
this?
Damon Chandler (TeamB) wrote:
> Hi,
>
> You're catching the WM_COPYDATA in your TFormMain class, but you're
> sending the message to the window whose handle is returned via the
> following call...
>
> HWND hWnd = FindWindow("TApplication", "MutexTest");
>
> I don't believe the above call is returning the correct handle. You
> should replace "TApplication" with "TFormMain" and adjust the second
> parameter to the form's caption.
>
> As a side note, there's no need to use the WindowProc property since you
> can override the WndProc() method directly.
>
> Cheers,
> --
> Damon Chandler (TeamB)
> C++Builder Developer's Journal
> http://bcbjournal.com
> http://bcbjournal.org
>
> anon5 wrote:
>> Hey guys
>>
>> I am trying to create a 'once-only' app (only one instance can run).
> [snip 8<----]
>> Now, the once-only aspect of the app works great. But my WM_COPYDATA
>> message isn't being picked up at all. If anyone can help at all it
>> would be fantastic. Thanks!
Technical Details
Message-ID:
<46dbc9d0$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46db6544$1@newsgroups.borland.com> <46dbad32$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ae849346afde0161 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 03 Sep 2007 09:46:13 +0100 From: anon5 <bogus@mail.com> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: WM_COPYDATA problem References: <46db6544$1@newsgroups.borland.com> <46dbad32$1@newsgroups.borland.com> In-Reply-To: <46dbad32$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 82.32.100.249 Message-ID: <46dbc9d0$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1188809168 82.32.100.249 (3 Sep 2007 01:46:08 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail