?
Solved

RichEdit control

Posted on 1998-07-09
2
Medium Priority
?
413 Views
Last Modified: 2013-12-03
How to use the RichEdit control in C
(Sample code will be appreciated) ?
0
Comment
Question by:ct_consultant
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
BlackMan earned 150 total points
ID: 1409822
Here is something i got from a newsgroup a while ago..

void __fastcall TRichEditPlus::CreateParams(Controls::TCreateParams&Params){
      const char RichEditModuleName[] = "RICHED20.DLL";      long int OldError;
      OldError = SetErrorMode(SEM_NOOPENFILEERRORBOX);
      FLibHandle = (int) LoadLibrary(RichEditModuleName);
      if (FLibHandle < HINSTANCE_ERROR) FLibHandle = 0;      SetErrorMode(OldError);
//      TRichEdit::CreateParams(Params);      TCustomMemo::CreateParams(Params);
//      CreateSubClass(Params, "RICHEDIT");      CreateSubClass(Params, RICHEDIT_CLASS);
      Params.Style = Params.Style |            (HideScrollBars ? 0 : ES_DISABLENOSCROLL) |
            (HideSelection ? 0 : ES_NOHIDESEL);}
//---------------------------------------------------------------------------
// free the library on destroy (actually, it will not unload until last
// TRichEditPlus instance is destroyed)//
void __fastcall TRichEditPlus::DestroyWnd(void){      if (FRichEditOle) {
            delete FRichEditOle;            FRichEditOle = 0;            }      TRichEdit::DestroyWnd();
      if (FLibHandle != 0) FreeLibrary((void*) FLibHandle);}
//---------------------------------------------------------------------------
bool __fastcall TRichEditPlus::GetCanUndo(void){
      return ::SendMessage(Handle, EM_CANUNDO, 0, 0);}
//---------------------------------------------------------------------------
bool __fastcall TRichEditPlus::GetCanRedo(void){
      return ::SendMessage(Handle, EM_CANREDO, 0, 0);}
//---------------------------------------------------------------------------
bool TRichEditPlus::Undo(void){      // returns zero on failure
      return ::SendMessage(Handle, EM_UNDO, 0, 0);}
//---------------------------------------------------------------------------
bool TRichEditPlus::Redo(void){      // returns zero on failure
      return ::SendMessage(Handle, EM_REDO, 0, 0);}
//---------------------------------------------------------------------------
void __fastcall TRichEditPlus::SetUndoLimit(int limit){
      // returns number actually set -- may be smaller than request
      FUndoLimit = ::SendMessage(Handle, EM_SETUNDOLIMIT, limit, 0);}
//---------------------------------------------------------------------------
void TRichEditPlus::StopGroupTyping(void){
      // forces new group for undo -- cannot fail
      ::SendMessage(Handle, EM_STOPGROUPTYPING, 0, 0);}
//---------------------------------------------------------------------------
// build a string of text representing the nature of the next undo/redo//
static const char *UndoNames[] = {
      "Cannot ", " Typing", " Delete", " Drop Object", " Cut", " Paste"      };
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1409823
Oops, my cut&paste screwed the formatting - sorry! I hope you can read it, otherwise just reject it..
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses

809 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