how to get handle of child window

Go4Expert Member
21Sep2007,17:12   #1
ankurk's Avatar
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
Go4Expert Founder
21Sep2007,18:31   #2
shabbir's Avatar
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.
Go4Expert Member
22Sep2007,11:12   #3
ankurk's Avatar
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
Go4Expert Founder
22Sep2007,13:20   #4
shabbir's Avatar
GetDlgItem should help you get the Handle to the controls from the resource ID.
Go4Expert Member
22Sep2007,15:42   #5
ankurk's Avatar
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
Go4Expert Founder
22Sep2007,20:23   #6
shabbir's Avatar
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.
Go4Expert Member
24Sep2007,10:14   #7
ankurk's Avatar
ok got the things right , it's working now


Thanks

Keep up the good work .