Ejemplo n.º 1
0
// ****************************************************************************
//
//  Function Name:	RMFCCommandUI::GetDroppedState( )
//
//  Description:		This function is for when the update must be for a 
//							combobox.  If the RMFCCommandUI object is a combobox or has
//							a child combobox, this checks the combobox to see if its
//							list box is dropped.
//
//  Returns:			TRUE:		List box is dropped
//							FALSE:	List box is not dropped
//
//  Exceptions:		None
//
// ****************************************************************************
//
BOOLEAN RMFCCommandUI::GetDroppedState( )
	{
	TpsAssert( m_pCmdUI->m_pMenu == NULL, "CommandUI object is not a control" );
	TpsAssert( m_pCmdUI->m_pOther, "m_pCmdUI->m_pOther is NULL" );

	HWND hWnd = m_pCmdUI->m_pOther->GetSafeHwnd();
	CWnd* pWnd = NULL;

	while ( hWnd )
		{
		pWnd = pWnd->FromHandle( hWnd ); 
		if ( pWnd->IsKindOf( RUNTIME_CLASS( CComboBox ) ) )
			{
				CComboBox* pComboBox = ( CComboBox* )pWnd;
				return BOOLEAN( pComboBox->GetDroppedState() );
			}
		else
			hWnd = ::GetWindow( hWnd, GW_CHILD );
		}

	TpsAssertAlways( "RMFCCommandUI object is not a combobox" );
	return FALSE;
	}