Главная страница | назад





Article #16055: Avoiding an Application Error when using EM_POSFROMCHAR

 Question and Answer Database
FAQ1055D.txt Avoiding an Application Error when using EM_POSFROMCHAR
Category :VCL
Platform :All
Product :Delphi 3.x
Question:
How can I avoid an Application Error when using the EM_POSFROMCHAR
and EM_POSFROMCHAR in a RichEdit control?
Answer:
The definitions for EM_CHARFROMPOS and EM_POSFROMCHAR are different
in the RichEdit and Messages units:
RichEdit unit:
EM_POSFROMCHAR = WM_USER + 38;
EM_CHARFROMPOS = WM_USER + 39;
Messages unit:
EM_POSFROMCHAR = 214;
EM_CHARFROMPOS = 215;
To avoid confusion, these constants have been removed from the
RichEdit unit in Delphi 3.
When using the EM_POSFROMCHAR message, WParam should contain the
address of the point structure that will receive the coordinates,
and LParam should contain the zero based offset of the character. The
return value is not initialized. Note that the y coordinate can be
zero or negative.
When using EM_CHARFROMPOS, wparam is not used, and LParam should
contain the address of the point structure that will receive the
coordinates. The return value should contain the required character
index.
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99