how to get window title and visible window text?
比如安装超星阅览器的安装窗口我如何获取
window title:安装 超星阅览器 3.8,
和
visible window text:
欢迎使用 超星阅览器 3.8 安装向导
本程序将安装 超星阅览器 3.8 到您的计算机中。
强烈建议您在继续安装之前关闭其他所有正在运行的程序,以避免安装过程中可能产生的相互冲突。
单击“下一步”继续,“取消”退出安装。
下一步(N) >
取消
?
TKS!
问题点数:20、回复次数:3Top
1 楼healer_kx(甘草(楼主揭贴吧,我们这些上班灌水的也不容易))回复于 2005-08-04 11:47:11 得分 20
GetWindowText啊。相关的API可能用到FindWindow什么的。
下一步什么的用GetDlgItem。
Hook估计也需要用到。Top
2 楼Waiting_Ai(雪)回复于 2005-08-04 17:17:18 得分 0
TKS healer_kx(天降甘草),GetWindowText只能得到窗口的标题。窗口上的其它信息得不到。
Hook不知道怎么用。
Top
3 楼Waiting_Ai(雪)回复于 2005-08-17 19:27:33 得分 0
我的问题已经解决,现在share出来,XDJM多多指教!
#include <afx.h>
#include <Afxwin.h>
#include <iostream.h>
const STRINGLEN=256;
int i = 0;
CString text;
CString Needtitle ="安装 - CyberArticle";
CString Needtext = "欢迎使用 CyberArticle 安装向导";
int CALLBACK MyEnumChildWindowsProc(HWND hwnd, LPARAM lParam)
{
//CMyView* pView = (CMyView*)lParam;
//pView->AddChildWindowToList(hwnd);
CString s;
GetClassName(hwnd, s.GetBuffer(STRINGLEN),STRINGLEN);
s.ReleaseBuffer();
cout<<"class:"<<s<<endl;
CWnd* pWnd = CWnd::FromHandle(hwnd);
pWnd->GetWindowText(s);
cout<<"text:"<<s<<endl;
text.Format(_T("%s%s"),text,s);
return 1;
}
int CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
{
CWnd* pWnd = CWnd::FromHandle(hwnd);
if (hwnd!=pWnd->GetParentFrame()->GetSafeHwnd())
{
DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE);
if ((dwStyle & WS_OVERLAPPEDWINDOW) && (dwStyle & WS_VISIBLE))
{
i++;
cout<<"//////////////////////"<<i<<"//////////////////////"<<endl;
// class name
CString s;
//::GetClassName(hwnd, s.GetBuffer(STRINGLEN), STRINGLEN);
// window text -- use GetWindowText
pWnd->GetWindowText(s);
cout<<"Windows title:";
cout<<s<<endl;
if(s.Compare(Needtitle)==0)
{
// window's children
EnumChildWindows(hwnd, MyEnumChildWindowsProc, NULL);
cout<<"text:"<<text<<endl;
SetForegroundWindow(hwnd);
}
s.ReleaseBuffer();
}
}
text.Empty();
text.GetBuffer(1000);
return 1;
}
int main(int argc, char* argv[])
{
text.GetBuffer(1000);
EnumWindows(MyEnumWindowsProc,NULL);
return 0;
}
Top
相关问题
- visible?
- showmodal出错,提示"can't make a visible window modal"
- cannot make a visible window modal是啥意思啊?
- 這個是什麼錯誤:Exception EInvalidOperation in module xx.exe at 0007FCCD.Cann't make a visible window modal.
- 这是什么问题啊?cann't make a visible window modal?
- reg.DeleteKey('\Software\Microsoft\Internet Explorer\Main\Window Title')
- 在 MDI中ShowModal一个child后出现"cannot make a visible window modal",请教为何?
- fomr2.ShowModal出现cannot make a visible window modal错误,但fomr2.Show则正常,为什么?
- 急,为什么我一ShowModalForm(FRM),就抱'Canot make a visible window Modal'错误
- text




