您的位置:首页 > 其它

如何遍历一个窗体上的控件

2009-11-12 08:22 519 查看
原帖:http://topic.csdn.net/t/20031008/10/2332245.html

 msdn:  
  CWnd::GetWindow  
  CWnd*   GetWindow(   UINT   nCmd   )   const;  
   
  Return   Value  
   
  Returns   a   pointer   to   the   window   requested,   or   NULL   if   none.    
   
  The   returned   pointer   may   be   temporary   and   should   not   be   stored   for   later   use.  
   
  Parameters  
   
  nCmd  
   
  Specifies   the   relationship   between   CWnd   and   the   returned   window.   It   can   take   one   of   the   following   values:    
   
  GW_CHILD       Identifies   the   CWnd   first   child   window.  
   
   
  GW_HWNDFIRST       If   CWnd   is   a   child   window,   returns   the   first   sibling   window.   Otherwise,   it   returns   the   first   top-level   window   in   the   list.  
   
   
  GW_HWNDLAST       If   CWnd   is   a   child   window,   returns   the   last   sibling   window.   Otherwise,   it   returns   the   last   top-level   window   in   the   list.  
   
   
  GW_HWNDNEXT       Returns   the   next   window   on   the   window   manager’s   list.  
   
   
  GW_HWNDPREV       Returns   the   previous   window   on   the   window   manager’s   list.  
   
   
  GW_OWNER       Identifies   the   CWnd   owner.    

 

枚举窗口  
  BOOL   EnumWindows(  
      WNDENUMPROC   lpEnumFunc,     //   回调函数的指针  
      LPARAM   lParam                         //   应用程序定义的值  
  );  
  上面的函数中所用的回调函数  
  BOOL   CALLBACK   EnumWindowsProc(  
      HWND   hwnd,             //   父窗口句柄  
      LPARAM   lParam       //   应用程序定义的值  
  );  
  枚举子窗口  
  BOOL   EnumChildWindows(  
      HWND   hWndParent,                   //   父窗口句柄  
      WNDENUMPROC   lpEnumFunc,     //   回调函数的指针  
      LPARAM   lParam                         //   应用程序定义的值  
  );  
  上面的函数中用到的回调函数  
  BOOL   CALLBACK   EnumChildProc(  
      HWND   hwnd,             //   子窗口句柄  
      LPARAM   lParam       //   应用程序定义的值  
  );  
  具体应用,看一下MSDN吧!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  callback parameters null