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.
这是MSDN上的解释,即 GetWindowText只能获得当前应用程序的窗口的标题。无法跨越进程。
但通过发送WM_GETTEXT消息,可以在不同进程间通信。
SetWindowText与WM_SETTEXT类似。
SendMessage(glhDisplayWnd,WM_SETTEXT,0,(LPARAM)(LPCTSTR)szCaption);
这是MSDN上的解释,即 GetWindowText只能获得当前应用程序的窗口的标题。无法跨越进程。
但通过发送WM_GETTEXT消息,可以在不同进程间通信。
SetWindowText与WM_SETTEXT类似。
SendMessage(glhDisplayWnd,WM_SETTEXT,0,(LPARAM)(LPCTSTR)szCaption);