小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

GetWindowText

 牛人的尾巴 2014-11-19

GetWindowText

目錄
展開

函數(shù)功能

該函數(shù)將指定窗口的標(biāo)題條文本(如果存在)拷貝到一個緩存區(qū)內(nèi)。如果指定的窗口是一個控件,則拷貝控件的文本。但是,GetWindowText不能接收其他應(yīng)用程序中控件的文本。

函數(shù)原型:Int GetWindowText(HWND hWnd,LPTSTR lpString,Int nMaxCount);

參數(shù)

hWnd:帶文本的窗口或控件的句柄。

IpString:指向接收文本的緩沖區(qū)的指針。

nMaxCount:指定要保存在緩沖區(qū)內(nèi)的字符的最大個數(shù),其中包含NULL字符。如果文本超過界限,它就被截?cái)唷?/p>

getwindowtext的DELPHI例子:

var

p:pchar;

begin

getmem(p,255);

getwindowtext(application.Handle,p,255);

showmessage(strpas(p));

freemem(p);

end;

返回值

如果函數(shù)成功,返回值是拷貝的字符串的字符個數(shù),不包括中斷的空字符;如果窗口無標(biāo)題欄或文本,或標(biāo)題欄為空,或窗口或控制的句柄無效,則返回值為零。若想獲得更多錯誤信息,請調(diào)用GetLastError函數(shù)。

函數(shù)不能返回在其他應(yīng)用程序中的編輯控件的文本。

備注

函數(shù)定義

如果目標(biāo)窗口屬于當(dāng)前進(jìn)程,GetWindowText函數(shù)給指定的窗口或控件發(fā)送WM_GETTEXT消息。如果目標(biāo)窗口屬于其他進(jìn)程,并且有一個窗口標(biāo)題,則GetWindowTeXt返回窗口的標(biāo)題文本,如果窗口無標(biāo)題,則函數(shù)返回空字符串。

速查:Windows NT:3.1以上版本;Windows:95以上版本:Windows CE:1.0以上版本;頭文件:Winuser.h;庫文件:user32.lib:Unicode:在Windows NT上實(shí)現(xiàn)為Unicode和ANSI兩種版本。

int GetWindowText(

LPTSTR lpszStringBuf,

int nMaxCount

) const;

void GetWindowText(

CString& rString

) const;

Parameters參數(shù)

lpszStringBuf

[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.

rString

A CString object that is to receive the copied string of the window's title.

Return Value返回值

Specifies the length, in characters, of the copied string, not including the terminating null character. It is 0 if CWnd has no caption or if the caption is empty.

Remarks

If the CWnd object is a control, the GetWindowText member function copies the text within the control instead of copying the caption.

This member function causes the WM_GETTEXT message to be sent to the CWnd object.

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多