已知对话框的句柄
怎样通过此句柄得到该对话框上某个控件的指针?

解决方案 »

  1.   

    HWND GetDlgItem(HWND hDlg,int nIDDDlgItem);
      

  2.   

    FindWindowEx FunctionThe FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window. This function does not perform a case-sensitive search.SyntaxHWND FindWindowEx(          HWND hwndParent,
        HWND hwndChildAfter,
        LPCTSTR lpszClass,
        LPCTSTR lpszWindow
    );
    HWND hChild = FindWindowEx(dlg_hwnd, NULL, "Button", "按钮1");