Solved

Inserting an Image into a Rich Edit Control

Posted on 1997-10-10
5
368 Views
Last Modified: 2013-11-20
How do I insert an image into a Rich Edit Control?
It needs to be pretty fast.
0
Comment
Question by:nicr
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:gelbert
Comment Utility
Make CStatic member of your class derived from CRichEditCtrl. And use this member to display images by showing and hiding its window and resetting images
0
 

Author Comment

by:nicr
Comment Utility
Perhaps I need to clarify my question as well.  The image needs to be inline with text already displayed in the Rich Edit control.
0
 
LVL 1

Accepted Solution

by:
kburns102197 earned 100 total points
Comment Utility
The easy way is to do it through the clipboard.
The steps are as follows:
1)Override CopyToClipBoard (member of COleServerItem)
    a) ::OpenCipboard(0);
    b) :: SetClipBoardData(CF_BITMAP(many options- see help,handle);
    c) ::CloseClipBoard( );
2) Move cursor to place to be inserted programmatically or manually
3) Paste It!
    a)  CRichEditCtrl& pCntrl=GetRichEditCtrl( );
    b)  pCtrl.Paste( );

Thats It!  If you need more help - give me your class data & I'll give you the
specific code.
0
 

Author Comment

by:nicr
Comment Utility
Sorry about the delay.  The only problem with this
method is that it destroys the clipboard contents.  How do I avoid this from happening?
0
 
LVL 1

Expert Comment

by:kburns102197
Comment Utility
This the generally accepted method of performing this function.  Simply save the clipboard contents first , make your transfer, then retore it.  Let me know if you need more details.. kburns
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now