Iterate through controls on Dialog Box
-
Hi, I am doing GUI programming using Win32 SDK (no MFC). I have a dialog box with 2 text fields, 2 static (labels) and 2 buttons. I wish resize the dialolg box and move / resize the 6 controls on it. Can anyone suggest how to get handles to all the 6 child windows to do SetWindowPos for each? I have tried using GetWindow with GW_CHILD and GW_HWNDNEXT. However I can get only the text boxes on the dialog box. Moreover, I have noticed that the while loop to enumerate child windows goes into infinite loop. Please suggest some solution.
-
Hi, I am doing GUI programming using Win32 SDK (no MFC). I have a dialog box with 2 text fields, 2 static (labels) and 2 buttons. I wish resize the dialolg box and move / resize the 6 controls on it. Can anyone suggest how to get handles to all the 6 child windows to do SetWindowPos for each? I have tried using GetWindow with GW_CHILD and GW_HWNDNEXT. However I can get only the text boxes on the dialog box. Moreover, I have noticed that the while loop to enumerate child windows goes into infinite loop. Please suggest some solution.
-
Hi, I am doing GUI programming using Win32 SDK (no MFC). I have a dialog box with 2 text fields, 2 static (labels) and 2 buttons. I wish resize the dialolg box and move / resize the 6 controls on it. Can anyone suggest how to get handles to all the 6 child windows to do SetWindowPos for each? I have tried using GetWindow with GW_CHILD and GW_HWNDNEXT. However I can get only the text boxes on the dialog box. Moreover, I have noticed that the while loop to enumerate child windows goes into infinite loop. Please suggest some solution.
-
Hi, I am doing GUI programming using Win32 SDK (no MFC). I have a dialog box with 2 text fields, 2 static (labels) and 2 buttons. I wish resize the dialolg box and move / resize the 6 controls on it. Can anyone suggest how to get handles to all the 6 child windows to do SetWindowPos for each? I have tried using GetWindow with GW_CHILD and GW_HWNDNEXT. However I can get only the text boxes on the dialog box. Moreover, I have noticed that the while loop to enumerate child windows goes into infinite loop. Please suggest some solution.
Hi, Thanks for the replies. I finally managed to achieve the functionality using GetWindow itself. The problem was, I initially did a SetWindowPos immediately after acquiring the window handle to the child control. This changed the Z-order of the windows and because of which it went into infinite loop. I have now implemented following solution: 1. Collect all the child window handles in a container such as list 2. Iterate through the list applying the modifications to each of the window using the window handles. This iteration has to be done using reverse_iterator. I suspect that this is essential because the first child of the parent window is the control with highest tab index, or highest Z-order. So to maintain the tab order, one has to do reverse-iteration. [Kindly confirm :)] Rgds, Mandar Wish you all a Very Happy New Year!