GetWndLineWidth (hwnd, ln, cch)

Returns the width of a specified line of text in the given window.  





The window.


The line number that contains the text to be mea­sured. If ln is out of range, then –1 is returned.


The count of characters to measure on the line. If cch is set to –1, then the whole line length is measured.

This function allows you to measure the width of characters in a given window. Since the font used by each window is determined by the file's document type, the width of text can vary from window to window. Syntax formatting also affects the width of text.

This function can be used along with ScrollWndHoriz to scroll a window to show a particular character.


To find the width of the whole line at line 100:

dim = GetWndLineWidth(hwnd, 100, -1)

Msg ("Line 100 is " # dim.cxp # " pixels wide.")


To find the width of the first 3 characters on line 200:

Dim = GetWndLineWidth(hwnd, 200, 3)