网站首页  词典首页

请输入您要查询的函数:

 

术语 getwindowtextlength
释义 GetWindowTextLength
语法:
int GetWindowTextLength( HWND hWnd
);
GetWindowTextLength函数
该GetWindowTextLength函数检索的长度,以字符,指定窗口的标题栏文字(如窗口有一个标题栏)。如果指定的窗口是一个控制,检索功能的控制范围内的文本的长度。然而,GetWindowTextLength无法检索的一个编辑在另一个应用程序的控制文本的长度。
参数
hWnd
[in]的窗口句柄或控制。
返回值
如果函数成功,返回值是长度,字符的文本。在某些情况下,这个值实际上可能大于文本的长度。有关详细信息,请参阅下面的备注部分。
如果窗口无文字,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
如果目标窗口是由当前进程拥有,GetWindowTextLength导致WM_GETTEXTLENGTH信息发送到指定的窗口或控制。
在某些条件下,GetWindowTextLength函数可能会返回一个值小于文本的实际长度较大。出现这种情况与一些ANSI和Unicode的混合物,是由于系统的双字节字符集(DBCS)字符可能存在允许范围内的文本。返回值,但是,将始终至少有一样大文本的实际长度,您可以因此总是用它来指导缓冲区分配。发生这种现象,当应用程序同时使用的ANSI职能和公共对话框,其中使用Unicode。它也可以发生在应用程序使用一个窗口的窗口过程是Unicode,或GetWindowTextLength一个窗口的窗口过程是ANSI Unicode版本的GetWindowTextLength ANSI版本。欲了解更多有关的ANSI和ANSI函数的详细信息,请参阅函数原型公约。
要获取文本的确切长度,使用WM_GETTEXT的,LB_GETTEXT,或CB_GETLBTEXT消息,或在GetWindowText函数。
在Windows 95/98/Me:GetWindowTextLengthW是支持的Unicode(MSLU)微软层。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98/Me系统。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
视窗概述,CB_GETLBTEXT,GetWindowText,LB_GETTEXT,函数SetWindowText,WM_GETTEXT的,WM_GETTEXTLENGTH
==英文原文==GetWindowTextLength Function
The GetWindowTextLength function retrieves the length, in characters, of the specified window's title bar text (if the window has a title bar). If the specified window is a control, the function retrieves the length of the text within the control. However, GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.
Syntax
int GetWindowTextLength( HWND hWnd
);
Parameters
hWnd
[in] Handle to the window or control.
Return Value
If the function succeeds, the return value is the length, in characters, of the text. Under certain conditions, this value may actually be greater than the length of the text. For more information, see the following Remarks section.
If the window has no text, the return value is zero. To get extended error information, call GetLastError .
Remarks
If the target window is owned by the current process, GetWindowTextLength causes a WM_GETTEXTLENGTH message to be sent to the specified window or control.
Under certain conditions, the GetWindowTextLength function may return a value that is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the system allowing for the possible existence of double-byte character set (DBCS) characters within the text. The return value, however, will always be at least as large as the actual length of the text; you can thus always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode. It can also occur when an application uses the ANSI version of GetWindowTextLength with a window whose window procedure is Unicode, or the Unicode version of GetWindowTextLength with a window whose window procedure is ANSI. For more information on ANSI and ANSI functions, see Conventions for Function Prototypes .
To obtain the exact length of the text, use the WM_GETTEXT , LB_GETTEXT , or CB_GETLBTEXT messages, or the GetWindowText function.
Windows 95/98/Me: GetWindowTextLengthW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.
See Also
Windows Overview , CB_GETLBTEXT , GetWindowText , LB_GETTEXT , SetWindowText , WM_GETTEXT , WM_GETTEXTLENGTH
==原始网址==http://msdn.microsoft.com/en-us/library/ms633521(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:18:00