🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem with monitorng the clipboard (other viewers does not receive notifications)

#4391
From: JD
Date: Wed, 01 Feb 2006 14:58
51 lines
2487 bytes
"Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote:
>
> [...] but *other* clipboard viewers does not receive
> clipoard changes any more, untill I close my app.

From the win32.hlp on SetClipboardViewer:

    Each clipboard viewer window calls the SendMessage
    function to pass these messages to the next window
    in the clipboard viewer chain.

You are not passing the WM_DRAWCLIPBOARD message along.

>   PostMessage( hNextViewer, WM_CHANGECBCHAIN, (WPARAM)

The help says to use SendMessage. You also need to check
hNextViewer because that could be NULL.

>void __fastcall TForm1::ClpBrdNotify( TMessage& Message )
>{
>   if ( ::Clipboard()->HasFormat( CF_TEXT ) )
>   {
>      AnsiString cText = ::Clipboard()->AsText;
>      Memo1->Lines->Add( cText );
>   }

You need to pass the WM_DRAWCLIPBOARD message here (if
hNextViewer is not NULL).

>1) How should I check the correctness of SetClipboardViewer()
>regarding this:

<snip>

>   ::SetLastError( 0 );
>   hNextViewer = SetClipboardViewer( Handle );
>   if ( ( !hNextViewer ) && ( ::GetLastError() ) )
>   {

Without testing it, I would expect this to be incorrect because
I would expect an error every time there is no HWND to return
just because Windows does stuff like that.

>2) Is there any signifficant differences between these two approachs
>to read the clipboard:

Other than the fact that one method is more simple than the
other?

~ JD
Technical Details
Message-ID: <43e0dab4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43e0cf69$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6fad66537802daaf
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: Problem with monitorng the clipboard (other viewers does not receive notifications)
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 205.188.116.136     
X-Forwarded-For: 172.136.135.209
References:  <43e0cf69$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <43e0dab4$1@newsgroups.borland.com>
Date: 1 Feb 2006 07:58:44 -0700
X-Trace: newsgroups.borland.com 1138809524 207.105.83.66 (1 Feb 2006 07:58:44 -0700)
Lines: 52
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail