又是没先好好看MSDN的注释,浪费了半天时间。。。
看来磨刀不误砍柴工真是没错啊。。

SendMessage( 
  (HWND) hWnd,          
// handle to destination window 
  EM_GETLINE,           // message to send
  (WPARAM) wParam,      // line number
  (LPARAM) lParam       // line buffer (LPCTSTR)
);



Parameters

wParam

Specifies the zero-based index of the line to retrieve from a multiline edit control. A value of zero specifies the topmost line. This parameter is ignored by a single-line edit control.

lParam

Pointer to the buffer that receives a copy of the line. Before sending the message, set the first word of this buffer to the size, in TCHARs, of the buffer. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. The size in the first word is overwritten by the copied line.
Return Values

The return value is the number of TCHARs copied. The return value is zero if the line number specified by the wParam parameter is greater than the number of lines in the edit control.

Remarks
Edit controls: The copied line does not contain a terminating null character.



所以要类似这样调用:

 *((LPWORD)gBuf) = MAX_GBUF;
 int nLen = SendMessage(hWnd, EM_GETLINE, nLine, (LPARAM)gBuf);
 gBuf[nLen] = '\0';