简体   繁体   English

如何获取对话框项文本的长度?

[英]How to get the length of a dialog item text?

Im trying to get the dialog item text into a buffer.我试图将对话框项文本放入缓冲区。 It works with GetDlgItemText() , but how do i get the length of the text so i can allocate the buffer before i read it in there?它适用于GetDlgItemText() ,但我如何获得文本的长度,以便在我在那里读取之前分配缓冲区? I want to be sure i always get the whole text.我想确保我总是得到整个文本。 I could use always for example 10k buffer, but it would be nicer if there wasnt any chance that the user text isnt received completely.例如,我可以始终使用 10k 缓冲区,但如果没有任何机会无法完全接收到用户文本,那就更好了。

Send the window handle, obtained by calling GetDlgItem , a WM_GETTEXTLENGTH message.发送通过调用GetDlgItem获得的 window 句柄,即WM_GETTEXTLENGTH消息。 Or if you prefer call GetWindowTextLength .或者,如果您更喜欢调用GetWindowTextLength

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM