Solved

RichEdit control

Posted on 1998-07-09
2
395 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 50 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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 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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now