!高分!关于截获其他程序窗口的 文字 的 有关问题
!高分!关于截获其他程序窗口的 文字 的 问题
一个程序窗口中显示很多文字
我如何用自己的程序获得他里面的文字
比如他有一个对话框 我的程序要能读出他对话框的内容 并保存成文本
大概思路 和 用到哪些东西
------解决方案--------------------
HWND WindowFromPoint( POINT Point);获得指定点的顶层窗口
HWND ChildWindowFromPointEx(
HWND hwndParent, // handle to parent window
POINT pt, // structure with point coordinates
UINT uFlags // skipping flags
);//获得指定窗口指定位置的子窗口
int GetWindowText(
HWND hWnd, // handle to window or control with text
LPTSTR lpString, // address of buffer for text
int nMaxCount // maximum number of characters to copy
);//获得指定窗口内的文本
------解决方案--------------------
ClientToScreen(&point);
HWND hWnd = ::WindowFromPoint(point);
if(hWnd != NULL)
{
::ScreenToClient(hWnd,&point);
HWND hChildWnd = ::ChildWindowFromPointEx(hWnd,point,CWP_SKIPINVISIBLE);
if(hChildWnd == NULL)
hChildWnd =hWnd;
char buffer[256];
::GetWindowText(hChildWnd,buffer,256);
m_strWindowText=buffer;
GetClassName(hChildWnd,buffer,256);
m_strWindowClass=buffer;
::SendMessage(hWnd,WM_GETTEXT,256,(long)buffer);
m_strText=buffer;
}
一个程序窗口中显示很多文字
我如何用自己的程序获得他里面的文字
比如他有一个对话框 我的程序要能读出他对话框的内容 并保存成文本
大概思路 和 用到哪些东西
------解决方案--------------------
HWND WindowFromPoint( POINT Point);获得指定点的顶层窗口
HWND ChildWindowFromPointEx(
HWND hwndParent, // handle to parent window
POINT pt, // structure with point coordinates
UINT uFlags // skipping flags
);//获得指定窗口指定位置的子窗口
int GetWindowText(
HWND hWnd, // handle to window or control with text
LPTSTR lpString, // address of buffer for text
int nMaxCount // maximum number of characters to copy
);//获得指定窗口内的文本
------解决方案--------------------
ClientToScreen(&point);
HWND hWnd = ::WindowFromPoint(point);
if(hWnd != NULL)
{
::ScreenToClient(hWnd,&point);
HWND hChildWnd = ::ChildWindowFromPointEx(hWnd,point,CWP_SKIPINVISIBLE);
if(hChildWnd == NULL)
hChildWnd =hWnd;
char buffer[256];
::GetWindowText(hChildWnd,buffer,256);
m_strWindowText=buffer;
GetClassName(hChildWnd,buffer,256);
m_strWindowClass=buffer;
::SendMessage(hWnd,WM_GETTEXT,256,(long)buffer);
m_strText=buffer;
}