我在对话框里用以下函数取Edit控件的句柄,
Number=FindWindowEx(WinH,0,"Edit",NULL);但只能取第一个Edit控件的句柄,如何取第二个,第三个呢?

解决方案 »

  1.   

    下一次就是
    Number=FindWindowEx(WinH,Number,"Edit",NULL);
      

  2.   

    该函数的第二个参数;
    hwndChildAfter 
    [in] Handle to a child window. The search begins with the next child window in the Z order. The child window must be a direct child window of hwndParent, not just a descendant window. 
    If hwndChildAfter is NULL, the search begins with the first child window of hwndParent. Note that if both hwndParent and hwndChildAfter are NULL, the function searches all top-level and message-only windows. 
    代表从哪个窗口开始查找
      

  3.   

    FindWindowEx(WinH,Number,"Edit",NULL);di第二个参数指明表示从哪个窗口开始查找,具体看msdn
      

  4.   

    每个控件都有固定的Ctrl_id,为什么不使用GetDlgItem(hwndDlgWin,control_id)来取句柄呢?
      

  5.   

    如果他们是连在一起的,可以考虑用HWND GetNextWindow(HWND hWnd,UNIT wCmd)参数:    hWnd:一个窗口的句柄。窗口句柄在wCmd参数的基础上获得的相对于这个窗口的句柄。    wCmd:指明窗口返回的是前一窗口的句柄还是后一窗口的句柄。该参数可以是下列两个值之一:    GW HWNONEXT:返回在给定窗口的下面窗口的句柄。    GW_HWNDPREV:返回在给定窗口的上面窗口的句柄。或者用GetDlgItem(hwndDlgWin,control_id),
    但这个需要用spy++等工具来看控件的id
      

  6.   

    同意xjtuzhw(飞影-->飞到哪里是终点?)