Enumerating controls in a form or dialogue box
I have placed my own activeX control in a MFC dialogue box and using this control i want to enumerate all the controls that are
present in that dialogue box. I am able to get the IClientSite pointer but unable to get the IOleContainter interface pointer.
Does VC implements IOleContainer Interfacer?
If not give me an alternative to enumerate the items present in the form or dialogue box.
Re: Enumerating controls in a form or dialogue box
With next function you will receive pointer to every controls in a dialog until the curent controls == intitialControl(the controls who have focus)
void CMyDialog::Controls()
{
CWnd* pInitialCtrl = GetFocus();
//do something with first control yhat is pInitialCtrl
CWnd *pWndIterator = NextDlgCtrl();
while( pWndIterator != pInitialCtrl )
{
//do something with the control
pWndIterator = NextDlgCtrl();
}
}
If that's help you let me know
Best regards,
Ovidiu
Re: Enumerating controls in a form or dialogue box
Thanks for the suggestion Ovidiu,
I think this still doesnot solve my problem . I have an activex control created using ATL . The control requires to use the method inside the IOleContainer interface . The Control works fine in VB . Means to say that VB is implementing the interface IOleContainer. If I insert the same control inside the Dialogbox in a MFC based app. the control is not able to get the IOleContainer Interface pointer .
I need to use the EnumObjects method inside the IOleContainer interface .
Can someone throw light on this .
regards
ayyappan