用FindWindow()得到DialogBar的句柄,再用FindWindowEx()获得按钮句柄 获得DialogBar句柄 HWND FindWindow( LPCTSTR lpClassName, // class name LPCTSTR lpWindowName // window name ); 获得子窗口句柄 HWND FindWindowEx( HWND hwndParent, // handle to parent window HWND hwndChildAfter, // handle to child window LPCTSTR lpszClass, // class name LPCTSTR lpszWindow // window name );2、用GetDlgItem(IDD_DLGBAR)->GetDlgItem(IDC_BUTTON)->m_hWnd 得到按钮句柄希望对你有所帮助
我用GetDlgItem取得的DialogBar句柄为0,这是怎么回事啊?
Dialog bars are extensions to a main window and any dialog-bar control-notification messages, such as BN_CLICKED or EN_CHANGE, will be sent to the parent of the dialog bar — the main window.
获得DialogBar句柄
HWND FindWindow(
LPCTSTR lpClassName, // class name
LPCTSTR lpWindowName // window name
);
获得子窗口句柄
HWND FindWindowEx(
HWND hwndParent, // handle to parent window
HWND hwndChildAfter, // handle to child window
LPCTSTR lpszClass, // class name
LPCTSTR lpszWindow // window name
);2、用GetDlgItem(IDD_DLGBAR)->GetDlgItem(IDC_BUTTON)->m_hWnd
得到按钮句柄希望对你有所帮助