?
Solved

Inserting an Image into a Rich Edit Control

Posted on 1997-10-10
5
Medium Priority
?
440 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:gelbert
ID: 1307925
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
ID: 1307926
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 300 total points
ID: 1307927
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
ID: 1307928
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
ID: 1307929
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 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