如果问是VC的,放到VC论坛上去吧。
如果问的是java能不能实现这个功能,很遗憾的告诉你纯java无法实现。
POINT sPoint;
HWND m_hWnd;char sClassName[200];
TCHAR sText[500];
GetCursorPos(&sPoint);
m_hWnd=::WindowFromPoint(sPoint);//返回包含了指定点的窗口的句柄HWND
::SendMessage(m_hWnd,WM_GETTEXT,sizeof(sText),LPARAM(sText));
m_sText.Format("内容:%s",sText);
if(m_sText.IsEmpty())
AfxMessageBox("Empty",MB_OK|MB_ICONINFORMATION);CWnd* m_cWnd=CWnd::WindowFromPoint(sPoint);
HWND hwndCurr = m_cWnd->GetSafeHwnd();
// Make sure that the window doesn't 'belong' to us
if ((::GetWindowThreadProcessId (GetSafeHwnd(), NULL))
!= (::GetWindowThreadProcessId (hwndCurr, NULL)))
{
::GetClassName(hwndCurr,sClassName,sizeof(sClassName));
m_sHandle.Format("0x%8.8X",m_hWnd);
m_sClassName.Format("%s",sClassName);
}
//显示前台窗口名
char m_cTAWindName[256];
HWND m_hFWind=::GetForegroundWindow();
::GetWindowText(m_hFWind,m_cTAWindName,256);
如果问的是java能不能实现这个功能,很遗憾的告诉你纯java无法实现。
POINT sPoint;
HWND m_hWnd;char sClassName[200];
TCHAR sText[500];
GetCursorPos(&sPoint);
m_hWnd=::WindowFromPoint(sPoint);//返回包含了指定点的窗口的句柄HWND
::SendMessage(m_hWnd,WM_GETTEXT,sizeof(sText),LPARAM(sText));
m_sText.Format("内容:%s",sText);
if(m_sText.IsEmpty())
AfxMessageBox("Empty",MB_OK|MB_ICONINFORMATION);CWnd* m_cWnd=CWnd::WindowFromPoint(sPoint);
HWND hwndCurr = m_cWnd->GetSafeHwnd();
// Make sure that the window doesn't 'belong' to us
if ((::GetWindowThreadProcessId (GetSafeHwnd(), NULL))
!= (::GetWindowThreadProcessId (hwndCurr, NULL)))
{
::GetClassName(hwndCurr,sClassName,sizeof(sClassName));
m_sHandle.Format("0x%8.8X",m_hWnd);
m_sClassName.Format("%s",sClassName);
}
//显示前台窗口名
char m_cTAWindName[256];
HWND m_hFWind=::GetForegroundWindow();
::GetWindowText(m_hFWind,m_cTAWindName,256);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货