Solved

Inserting an Image into a Rich Edit Control

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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
Unix / Linux grid computing 5 169
fizzArray2 challenge 1 103
pre4 challenge 19 111
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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