EM_GETLINE的古怪

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

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



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';

转载于:https://www.cnblogs.com/bcpl/archive/2005/03/24/124524.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值