I need to get the cursor location inside my RichEdit, There is no such thing as EM_GETCURSOR, or anything...
All i can get is the scroll position of my vscrollbar... :eek:
Printable View
I need to get the cursor location inside my RichEdit, There is no such thing as EM_GETCURSOR, or anything...
All i can get is the scroll position of my vscrollbar... :eek:
http://msdn.microsoft.com/library/de.../em_getsel.aspQuote:
Originally Posted by MSDN
-r1ck0r
I don't want the selection, i just want the current cursor location. Or can i get that from selection???
If no text is selected, both the starting character position and the ending character position will be equal, this value will be the cursor position.
thanks.
I need to convert that number to int, do you have any idea how to do that?
Heres what i tryed:
Code:int where = 0;
LPDWORD where1 = 0;
SendMessage(children.eBook, EM_GETSEL, 0, (LPARAM)where1);
where = (int)where1; // this doesn't work
Code:DWORD start;
DWORD end;
SendMessage(hwnd, EM_GETSEL, (WPARAM) &start, (LPARAM) &end);
where = end;
althought I have no idea (remember your excelent comment?) , you should get the client rect to get the entire client area, the get the edit rect, and finaly get the cursor position, with some simple calculations you will be able to relate those 10 values to get the cursor position inside the edit
niara
^That's a whole lot of fuss considering the EM_GETSEL message does the exact thing he wants, why reinvent the wheel? ;)
agree.Quote:
Originally Posted by r1ck0r
So heres what i want to do...
I want to write down the current location of cursor on a status control,
therefor i need the string.
But i just don't know how todo this...
If you got any other suggestion on how to do this i will highly appreciate it.Code:char text[50];
int location = 0;
DWORD where = 0;
SendMessage(xxx, EM_GETSEL ,............
location = where; // need to figure this out somehow
sprintf(text,"Location %i", location);