🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Continuing problem with SendMessage and WM_CCOPYDATA

#4280
From: Dennis Jones
Date: Tue, 28 Feb 2006 18:14
29 lines
1998 bytes
"JD" <nospam@nospam.com> wrote in message
news:44048bdc$1@newsgroups.borland.com...
>
> "Dennis Jones" <nospam@nospam.com> wrote:
> >
> >> I have a problem with this line because you could get the
> >> wrong instance.
> >
> > Wait...if you can only have one instance running, then how
> > could you possibly get the wrong instance?
>
> That block of code only executes if another instance of the
> application is already running:
>
>     if ( GetLastError() == ERROR_ALREADY_EXISTS )
>       {
>          HWND MainFormHWnd = FindWindow( "TMyApplicationMainForm", NULL );
>          ....
>       }
>
> How can you be sure that FindWindow returns the first instance
> v/s the instance in which that block is executing?

Well, along the same lines of what Alan said, this block of code is supposed
to exist in WinMain before Application->Run() is called, therefore, the
window has not been created yet.

- Dennis
Technical Details
Message-ID: <440492ff$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.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
References: <44021981$1@newsgroups.borland.com> <44024219$1@newsgroups.borland.com> <44046dac$1@newsgroups.borland.com> <4404752a$1@newsgroups.borland.com> <44048bdc$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6afbc9bf5041d787
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <44021981$1@newsgroups.borland.com> <44024219$1@newsgroups.borland.com> <44046dac$1@newsgroups.borland.com> <4404752a$1@newsgroups.borland.com> <44048bdc$1@newsgroups.borland.com>
Subject: Re: Continuing problem with SendMessage and WM_CCOPYDATA
Date: Tue, 28 Feb 2006 10:14:25 -0800
Lines: 31
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: 204.200.27.7
Message-ID: <440492ff$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1141150463 204.200.27.7 (28 Feb 2006 10:14:23 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.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