| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 504 人关注过本帖
标题:为啥找不到窗口呢,我觉得没错误啊,
只看楼主 加入收藏
yaoguai2005
Rank: 1
等 级:新手上路
帖 子:168
专家分:0
注 册:2005-9-11
收藏
 问题点数:0 回复次数:2 
为啥找不到窗口呢,我觉得没错误啊,

为啥这个查找窗口的程序,找不到指定的窗口呢
明明关键字的网页窗口就在桌面上
哪位给指点一下把
谢谢大家了

#include <stdio.h>
#include <windows.h>
int main(int argc, char *argv[])
{
HWND hw;
do{
hw=FindWindow(NULL,"找不到服务器");

}
while(hw == NULL );
if(hw==NULL)
{
MessageBox(NULL,"好啊","啊",0);

}

return 0;
}

搜索更多相关主题的帖子: 窗口 
2006-04-04 21:32
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
IE窗口比较特殊,你这样是找不到的,看看这个
  ////////////////////////////////////////////////////////////////
  // MSDN Magazine -- August 2003
  // If this code works, it was written by Paul DiLascia.
  // If not, I don't know who wrote it.
  // Compiles with Visual Studio .NET on Windows XP. Tab size=3.
  //
  // ---
  // This class encapsulates the process of finding a window with a given class name
  // as a descendant of a given window. To use it, instantiate like so:
  //
  // CFindWnd fw(hwndParent,classname);
  //
  // fw.m_hWnd will be the HWND of the desired window, if found.
  //
  class CFindWnd {
  private:
  //////////////////
  // This private function is used with EnumChildWindows to find the child
  // with a given class name. Returns FALSE if found (to stop enumerating).
  //
  static BOOL CALLBACK FindChildClassHwnd(HWND hwndParent, LPARAM lParam) {
  CFindWnd *pfw = (CFindWnd*)lParam;
  HWND hwnd = FindWindowEx(hwndParent, NULL, pfw->m_classname, NULL);
  if (hwnd) {
  pfw->m_hWnd = hwnd; // found: save it
  return FALSE; // stop enumerating
  }
  EnumChildWindows(hwndParent, FindChildClassHwnd, lParam); // recurse
  return TRUE; // keep looking
  }
  public:
  LPCSTR m_classname; // class name to look for
  HWND m_hWnd; // HWND if found
  // ctor does the work--just instantiate and go
  CFindWnd(HWND hwndParent, LPCSTR classname)
  : m_hWnd(NULL), m_classname(classname)
  {
  FindChildClassHwnd(hwndParent, (LPARAM)this);
  }
  };

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2006-04-04 22:42
yaoguai2005
Rank: 1
等 级:新手上路
帖 子:168
专家分:0
注 册:2005-9-11
收藏
得分:0 
原来要用FindWindowEx呀,
太感谢了,这么多月,你帮了我很多
真心的感谢

2006-04-04 22:58
快速回复:为啥找不到窗口呢,我觉得没错误啊,
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025331 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved