<p>Often time I need to add a control to a dialog after the dialog has been generated via dialog template and CreateDialogIndirect.  In these cases the tab order is set by the dialog template and there is no obvious way to change the tab order by including a newly created control.</p>

[{'answer_id': 50241, 'author': 'Karim', 'author_id': 2494, 'author_profile': 'https://Stackoverflow.com/users/2494', 'pm_score': 5, 'selected': True, 'text': '<p>I recently discovered that you can use SetWindowPos to accomplish this.  Determine which control after which you want to insert the new control in the tab order then use SetWindowPos like this:</p>\n\n<pre><code>SetWindowPos(hNewControl, hOldControl, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); \n</code></pre>\n\n<p>This changes the z-order of controls which, in turn, establishes the tab order.</p>\n'}, {'answer_id': 6654461, 'author': 'Mike Kwan', 'author_id': 712358, 'author_profile': 'https://Stackoverflow.com/users/712358', 'pm_score': -1, 'selected': False, 'text': '<p>I know this is an old question but here is how to do it at compile time (which is preferable in the vast majority of cases):\n<a href="http://msdn.microsoft.com/en-us/library/7039hzb0(v=vs.80).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/7039hzb0(v=vs.80).aspx</a></p>\n\n<p>My favourite method:</p>\n\n<ol>\n<li>From the View menu, choose Tab Order.</li>\n<li>Choose Assign Interactively.</li>\n<li>Double-click the tab order box beside the control you want to be the\nfirst control in the tab order.</li>\n<li>Click the tab order box for each of the other controls.</li>\n<li>Click anywhere on the form to save your changes and exit Tab Order\nmode, or press ESC to exit Tab Order mode without saving your\nchanges.</li>\n</ol>\n'}]
['https://Stackoverflow.com/questions/50236', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2494/']