RichEdit & Delphi 2


I was yesterday playing with the TRichEdit component found in Delphi
2.0. I noticed the very interesting messages EM_CHARFROMPOS and
EM_POSFROMCHAR in the Win32 help file. But when I tried to implement
these functions, I only got Access Violations.

The problem is that the above constants have two different
declarations, depending on which unit you use. The general Messages
unit defines EM_CHARFROMPOS as 215, but RichEdit unit as WM_USER+39
(1063). If I use the value in Messages unit, I get an AV, but if I use
the another one, I get a zero-result (I think the message gets not
handled because of a wrong constant value.)

The parameters for these message are correct, that is not the problem.
Both EM_CHARFROMPOS and EM_POSFROMCHAR can accept null parameters, but
of course, I have tried "good" values, too.

I have also tried to use these messages on a TMemo component. The
constants defined in the Messages unit work great on ordinary memos,
but not on TRichEdits. On TMemos, the constants in the unit RichEdit
also do nothing. Any suggestions?



Jani Jarvinen, Helsinki Finland

Check out Help Editor 2.0 for Windows at:

1996: Only four years to computer confusion!
What have you done to avoid it?

___ Blue Wave/QWK v2.12