This is a discussion on EM_GETLINE And Unicode? within the Windows Programming forums, part of the Platform Specific Boards category; You need to use SendMessageTimeout and not SendMessage if you want to obtain line counts etc from a multi-line edit/richedit ...
thanks for the reply, i tried this and had the same effect as before.
UNICODE is not the problem, the window handle you're using probably is. Try using an explicit handle for a known, open and active richedit/edit control (use spy++ or, if you don't have it, get a free variation from here; use the tool to get the handle of an active edit/richedit control). When you compare that with whatever handle you're trapping in code you'll probably find they're different.
Other test code you might consider implementing include
- Testing the handle you are attempting to use to ensure it actually belongs to an edit/richedit control ( use GetWindowLong/GetWindowLongPtr to test the style bits for ES_MULTILINE (if this style is absent from the window under scrutiny then messages such as EM_GETLINE and EM_GETLINECOUNT will always fail); popup a messagebox if the ES_MULTILINE style is absent).
- Testing the return value from SendMessageTimeOut
If, after taking some or all of these steps, you still have problems then post/attach your amended code.
Last edited by Ken Fitlike; 08-01-2004 at 07:05 AM.