|
-
Aug 5th, 2002, 04:43 PM
#1
Thread Starter
Frenzied Member
get line number
How can you get the line number in a multiline text box?
-
Aug 5th, 2002, 05:01 PM
#2
Frenzied Member
Code:
long TextBoxLine = SendMessage( hWnd, EM_LINEINDEX, (-1), 0L);
TextboxLine has the current line (one with the caret)
hWnd is the hWnd of the textbox.
-
Aug 5th, 2002, 11:08 PM
#3
Thread Starter
Frenzied Member
I think you need to use the EM_LINEFROMCHAR message to get the line number of the caret.
-
Aug 6th, 2002, 09:08 AM
#4
Frenzied Member
Not according to MSDN. This gets the active line
-
Aug 6th, 2002, 09:29 AM
#5
Thread Starter
Frenzied Member
I believe you are incorrect.
from MSDN
The EM_LINEINDEX message retrieves the character index of the first character of a specified line in a multiline edit control.
wParam
Specifies the zero-based line number. A value of –1 specifies the current line number (the line that contains the caret).
------------------------------------------------------------------------------
The EM_LINEFROMCHAR message retrieves the index of the line that contains the specified character index in a multiline edit control.
wParam
Specifies the character index of the character contained in the line whose number is to be retrieved. If this parameter is –1, EM_LINEFROMCHAR retrieves either the line number of the current line (the line containing the caret) or, if there is a selection, the line number of the line containing the beginning of the selection.
-
Aug 6th, 2002, 08:52 PM
#6
Fanatic Member

prog_tom
JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
http://physics.sviesoft.com/forum
-
Aug 7th, 2002, 03:11 PM
#7
Monday Morning Lunatic
It specifies that you specifically want a "long", not an "int" in the parameter. Almost irrelevant with C++ because it'll coerce the types anyway.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 7th, 2002, 03:41 PM
#8
Thread Starter
Frenzied Member
it's the same as (long)0
which is irrelevant as parksie said.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|