Solved

Inserting an Image into a Rich Edit Control

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 122
Creating Labels and Frequency list style reports in SAS code 9 98
Define unique primary key 9 92
unix example issues 18 90
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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