Loading ...
Sorry, an error occurred while loading the content.
 

Re: RichEdit on a Form

Expand Messages
  • momo@pob.huji.ac.il
    Sorry for teh late reply. we have had in the past a simmiler problem we had a richedit control but on some machines that had richedit version 2 it didnt work.
    Message 1 of 6 , Apr 30, 2001
      Sorry for teh late reply.
      we have had in the past a simmiler problem we had a richedit control but on some machines
      that had richedit version 2 it didnt work. well it was a bug in WTL here is aour workaround


      // Hack around the richedit bug (crash on window creation):
      // Richedit version 2.0 crashes in the WM_NCCREATE message because it performs
      // a string compare without first checking that the class value passed to CreateWindow
      // is an atom and not a class name.
      // To overcome the problem we intercept this message and if the class is designated by an
      // atom we replace the value with the class name.
      //
      LRESULT CRichEditTicker::OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam,
      BOOL& /*bHandled*/)
      {
      // Get at window creattion parameter structure
      LPCREATESTRUCT pcs = reinterpret_cast<LPCREATESTRUCT>(lParam);
      // Get at the class designator value
      DWORD dwClass = reinterpret_cast<DWORD>(pcs->lpszClass);
      // Is this value an atom (16 bit value) rather than a string pointer (32 bit)
      if ( dwClass && dwClass <= 0xFFFF ) {
      // If so, put in the "real" string name of the class
      pcs->lpszClass = GetWndClassName();
      }
      // Pass on to the richedit control
      return DefWindowProc(uMsg, wParam, lParam);
      }


      hope this helps
      --- In wtl@y..., PeteB@C... wrote:
      > I've a WTL form-based app, the dialog resource for the form contains
      > a rich edit control.
      >
      > Everything is fine if I use version 1 rich edit control but if I
      > change to version 2 or 3, the view fails to create.
      >
      > What am I missing? An app based on a rich edit as it's view is fine
      > with any version control, it's just if the view is a form.
      >
      > Thanks
      >
      > PeteB
      >
      > PS: is there a move to make WTL classes conform to (or at least
      > support) their MFC equivalent (e.g. WTL::CString Find method doesn't
      > have a "start at" parameter). Would you include changes if I sent
      > them to you Nenad?
    Your message has been successfully submitted and would be delivered to recipients shortly.