网站首页  词典首页

请输入您要查询的函数:

 

术语 getwindowtext
释义 GetWindowText
语法:
int GetWindowText( HWND hWnd,
LPTSTR lpString,
int nMaxCount
);
GetWindowText函数
在GetWindowText函数复制指定窗口的标题栏(如果有一到缓冲区)文本。如果指定的窗口是一个控制,控件的文本被复制。然而,GetWindowText不能检索在另一个应用程序的控制文本。
参数
hWnd
[in]的窗口句柄或控制包含文本。
lpString
[out]指向的缓冲区将接收文本。如果字符串为长或大于缓冲区的长,字符串被截断,以NULL字符结束。
nMaxCount
[in]指定的最大字符数复制到缓冲区,包括NULL字符。如果文本超过此限制,它被截断。
返回值
如果函数成功,返回值是长度,以字符,复制的字符串,不包括终止空字符。如果窗口没有标题栏或文本,如果标题栏为空,或者如果窗口或控制的句柄无效,则返回值是零。为了获得更多错误信息,调用GetLastError。
此功能无法检索的另一个应用程序中编辑控件中的文本。
备注
如果目标窗口是由当前进程拥有,GetWindowText导致WM_GETTEXT消息发送到指定的窗口或控制。如果目标窗口属于其他进程,并有一个标题,GetWindowText获取窗口标题文本。如果窗口没有标题,返回值是一个空字符串。此行为是设计使然。它允许应用程序调用,如果不成为响应的进程拥有目标窗口没有响应GetWindowText。但是,如果目标窗口不响应,它属于调用应用程序,GetWindowText将导致调用应用程序停止响应。
若要检索在另一个过程控制文本,发送WM_GETTEXT消息,而不是直接调用GetWindowText。
在Windows 95/98/Me:GetWindowTextW是支持的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版本。
参见
视窗概述,GetWindowTextLength,SetWindowText函数,WM_GETTEXT的
==英文原文==GetWindowText Function
The GetWindowText function copies the text of the specified window's title bar (if it has one) into a buffer. If the specified window is a control, the text of the control is copied. However, GetWindowText cannot retrieve the text of a control in another application.
Syntax
int GetWindowText( HWND hWnd,
LPTSTR lpString,
int nMaxCount
);
Parameters
hWnd
[in] Handle to the window or control containing the text.
lpString
[out] Pointer to the buffer that will receive the text. If the string is as long or longer than the buffer, the string is truncated and terminated with a NULL character.
nMaxCount
[in] Specifies the maximum number of characters to copy to the buffer, including the NULL character. If the text exceeds this limit, it is truncated.
Return Value
If the function succeeds, the return value is the length, in characters, of the copied string, not including the terminating NULL character. If the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid, the return value is zero. To get extended error information, call GetLastError .
This function cannot retrieve the text of an edit control in another application.
Remarks
If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control. If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string. This behavior is by design. It allows applications to call GetWindowText without becoming unresponsive if the process that owns the target window is not responding. However, if the target window is not responding and it belongs to the calling application, GetWindowText will cause the calling application to become unresponsive.
To retrieve the text of a control in another process, send a WM_GETTEXT message directly instead of calling GetWindowText.
Windows 95/98/Me: GetWindowTextW 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 .
Example
For an example, see Sending a Message .
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 , GetWindowTextLength , SetWindowText , WM_GETTEXT
==原始网址==http://msdn.microsoft.com/en-us/library/ms633520(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:20:54