how to get handle of child window

ankurk's Avatar, Join Date: Aug 2007
Go4Expert Member
hi guys i am creating many child windows using cdialog pointer at run time , depending upon the combo box selection in parent window; now i have to disable some controls of child window; using getdlgitem( control id, handle_of_child_window)->enable(FALSE);

so prob is how do i obtain the handle_of_child_window;


thanks in advance

ankur
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
There are lots of ways to be doing it

1. In your dialog you will have the control ddx'ed variables of your child window.
2. You know the control ID of the window's and can get the handle to the window.
3. You can go the hard way by enumerating the child window's as well.
0
ankurk's Avatar, Join Date: Aug 2007
Go4Expert Member
suppose i have the ID of the child window , then how can i get it's handel please explain.
i am just a beginner

thanks
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
GetDlgItem should help you get the Handle to the controls from the resource ID.
0
ankurk's Avatar, Join Date: Aug 2007
Go4Expert Member
na it's not working

GetDlgItem(IDC_NAME, IDD_CHILD_DLG)->EnableWindow(FALSE);

IDC_NAME is id of edit box , and the IDD_CHILD_DLG is id of chld dialog;

i want to disable the edit box depending upon some value in main dialog


thanks
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
If the API's are not working you are somewhere really wrong because they are tested over times to work correctly. Debug your code and see if you are getting the handle correctly and see if you have the parameters correctly.
0
ankurk's Avatar, Join Date: Aug 2007
Go4Expert Member
ok got the things right , it's working now


Thanks

Keep up the good work .