Solved

Inserting an Image into a Rich Edit Control

Posted on 1997-10-10
5
437 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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

718 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