Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4623872
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:03:00+00:00 2026-05-22T03:03:00+00:00

I need to copy a string and a bitmap to the clipboard. I have

  • 0

I need to copy a string and a bitmap to the clipboard.
I have implemented copying of a string:

if(OpenClipboard(NULL))
{
HGLOBAL clipbuffer;
char * buffer;
EmptyClipboard();
clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(source)+1);
buffer = (char*)GlobalLock(clipbuffer);
strcpy(buffer, LPCSTR(source));
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT,clipbuffer);
CloseClipboard();
}

I know how to copy image too, but i have to copy these two objects in one time (to get them in other process).
Please advice

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:03:00+00:00Added an answer on May 22, 2026 at 3:03 am

    If you are asking about how to put an image and string onto the clipboard such that if you pasted into Microsoft Word then both would appear, you almost certainly want to put data on the clipboard in Rich Text Format.

    I can’t offhand find a good example of code that does this at a low-level using CF_RTF. An easier high-level way would be to populate an invisible Rich Text control with what you want, select it, and fire off a copy. I personally would use Qt to do it:

    http://doc.qt.nokia.com/latest/qtextedit.html#copy

    You can register a custom format…

    http://msdn.microsoft.com/en-us/library/ms649013(v=vs.85).aspx#_win32_Registered_Clipboard_Formats

    …but then no other programs would be able to interpret the image/text combo unless they were recompiled to take your new format into account. Which pretty much undermines the point of using the clipboard in the first place. Though you could provide means for RenderFormat so it will paste as a bitmap in bitmap-like programs and as text in text-like programs.

    The way your question was worded you mentioned processes explicitly, and I was confused that you might be using the clipboard–which conceptually belongs to the user–to move arbitrary data between cooperating programs. There are other ways of doing that, like shared memory:

    http://msdn.microsoft.com/en-us/library/aa366551(v=vs.85).aspx

    (Note: If you felt like being really silly and have written both programs and don’t want to register a format…you could Base64 encode the bitmap as a string, and then glue it together with the text to make a single string you pass through. Then split it apart and decode it on the receiving end.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to copy a C# string into a char* . I have this
I have a method for copying files: private static void copy(final String source, final
I have a huge buffer of known size. I need to copy chunks of
I have a string in UCS-2 encoding. I need to copy this string to
I have a string std::string s = Stack Overflow; That I need to copy
I need to clean a string that comes (copy/pasted) from various Microsoft Office suite
I need to copy a table from one server to another.for that I have
I need to copy a file into a string. I need someway to preallocate
I have a need to copy a worksheet from one workbook into another and
I have two objects of the same type and need to copy property values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.