CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C++ 语言

how to get window title and visible window text?

楼主Waiting_Ai(雪)2005-08-04 11:33:03 在 C/C++ / C++ 语言 提问

比如安装超星阅览器的安装窗口我如何获取  
  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

关键词

  • 安装
  • getwindowtext
  • stringlen
  • 下一步
  • 超星阅览器3.8
  • cstring
  • hwnd
  • lparam
  • cout
  • text

得分解答快速导航

  • 帖主:Waiting_Ai
  • healer_kx

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo