Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   how to get handle of child window (http://www.go4expert.com/forums/handle-child-window-t6468/)

ankurk 21Sep2007 17:12

how to get handle of child window
 
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 :D

shabbir 21Sep2007 18:31

Re: how to get handle of child window
 
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.

ankurk 22Sep2007 11:12

Re: how to get handle of child window
 
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

shabbir 22Sep2007 13:20

Re: how to get handle of child window
 
GetDlgItem should help you get the Handle to the controls from the resource ID.

ankurk 22Sep2007 15:42

Re: how to get handle of child window
 
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

shabbir 22Sep2007 20:23

Re: how to get handle of child window
 
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.

ankurk 24Sep2007 10:14

Re: how to get handle of child window
 
ok got the things right , it's working now


Thanks

Keep up the good work .


All times are GMT +5.5. The time now is 15:16.