Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Paste to previously focused application

2 views
Skip to first unread message

Håkan Andersson

unread,
May 27, 2003, 2:08:02 AM5/27/03
to
Hi!

I've seen some applications from which one can paste text into the
previously focused application.

Example: MSWord has previously been selected. When, for instance, a button
is pressed in my application I would like the previuosly focused application
(MSWord) to get focused and the contents that I have put onto the clipboard
to be pasted where the cursor is in the Word application.

How can I achieve this with C++Builder?

Thanks in advance.

/Håkan Andersson


JJ

unread,
May 28, 2003, 5:49:44 PM5/28/03
to
You can have a single global instance of the clipboard object. These are
some example pieces of code:

if (Clipboard()->HasFormat(CF_TEXT))
{
QText->Clear () ;
AnsList->Clear () ;
StudentsAns->Clear () ;
QText->PasteFromClipboard () ;
}
else
ShowMessage ("No suitable data is on the Clipboard") ;

if (Clipboard()->HasFormat(CF_BITMAP))
{
Image->Picture->Bitmap->Assign(Clipboard ()) ;
}
else
if (Clipboard()->HasFormat(CF_PICTURE))
{
Image->Picture->Assign(Clipboard ()) ;
}
else
ShowMessage ("Nothing or incorrect data to paste") ;

Carry out a search for TClipboard in the help files

0 new messages