Article View: borland.public.cppbuilder.nativeapi
Article #15941Re: When is WM_DRAWCLIPBOARD sent?
From: Chris
Date: Wed, 04 Jun 2003 22:23
Date: Wed, 04 Jun 2003 22:23
112 lines
4067 bytes
4067 bytes
Well, there is code all over the place, and I do mean ALL over the place,
its a big project.
Basically...
I set my program as a clipboard viewer...
It needs to know if the user copies data onto the clipboard...
I edit and/or process the data if they copy something.
I call OpenClipboard
I actually call EmptyClipboard(); For this, and recreate the data.
I create the data using GlobalAlloc etc.
I add data using SetClipboardData()
When I'm done adding the data, I call CloseClipboard().
The problem is, when I edit the clipboard data, it thinks the user has
edited it.
The code is pretty rough, especially since Outlook didn't keep my
formatting, and its rather irrelevant.
For the clipboard viewer chain:
NextInChain = SetClipboardViewer(Form1->Handle);
I have my ClipboardMessage function to intercept the messages...
void __fastcall TForm1::ClipBoardMessage(TMessage &Message)
'CanUseClip' is a TTimer... It is also rather irrelevant.
void __fastcall TForm1::CanUseClipTimer(TObject *Sender)
{
CanUseClip->Enabled = false;
canuseclip = true;
}
void __fastcall TForm1::ClipBoardMessage(TMessage &Message)
{
if ( Message.Msg == WM_DRAWCLIPBOARD )
{
if(canuseclip)
{
canuseclip = false;
SendMessage(NextInChain, WM_DRAWCLIPBOARD, Message.WParam,
Message.LParam);
CopyListText();//simply notes what was copied...
if(Clip->Enabled == true)//this is a timer that never fires, if its
enabled, run this code...
{
if(msgin == false)//msgin tells the program whether it initiated the
message, or the user did
{
ClipTimer(Form1);//handle some data...
}
else
msgin = false;//in case msgin is true, it should now be false, since
we've ignored the message
}
CanUseClip->Enabled = true;// when we're done, re-enable editing....
}
else
msgin = false;//in case msgin is true, it should now be false, since we've
ignored the message
}
else if ( Message.Msg == WM_CHANGECBCHAIN )
{
long int Remove, Next;
Remove = Message.WParam;
Next = Message.LParam;
if(NextInChain == (HWND)Remove )
{
NextInChain = (HWND)Next;
}
else if (NextInChain != 0)
{
SendMessage(NextInChain, WM_CHANGECBCHAIN, Remove, Next);
}
}
}
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message
news:3ede689c$1@newsgroups.borland.com...
>
> "Chris" <Chris8852@adelphia.net> wrote in message
> news:3ede491e$1@newsgroups.borland.com...
>
> > Even then, I'm not sure I like the way I'm doing it. I
> > simply set a bool value that says the next message was
> > caused by my application, and in that case the program
> > ignores it. The problem is if this message never comes
> > at all, it will ignore the next message thats not from the
> > program... I'm using standard 'clipboard viewer' procedure.
>
> What does your actual code look like? The way you describe it, your
> implementation sounds to me like it is questionable in how you are
handling
> everything. Please show what you are actually doing.
>
>
> Gambit
>
>
Technical Details
Message-ID:
<3ede7181$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ede491e$1@newsgroups.borland.com> <3ede689c$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,c5ef94e94107b59a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-04 15:30:17 PST From: "Chris" <Chris8852@adelphia.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ede491e$1@newsgroups.borland.com> <3ede689c$1@newsgroups.borland.com> Subject: Re: When is WM_DRAWCLIPBOARD sent? Date: Wed, 4 Jun 2003 18:23:59 -0400 Lines: 114 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 68.65.164.124 Message-ID: <3ede7181$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1054765441 68.65.164.124 (4 Jun 2003 15:24:01 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail