Adding Tabs to a Tab Control
-
I added a tab control to my dialog box using the dialog editor in VC++. I cannot figure out how to add a tab to the control. I have attempted to use TabCtrl_InsertItem(hTemp, 0, &tci); where hTemp is gotten by GetDlgItem(hWndMain, Tab_1); under the WM_INITDIALOG, but the hTemp is always NULL. I can understand this because the control isn't created yey. if I do the same steps using a button to run them, then the tab will show up on the Tab Control. But I need it to show up when the window is created. Can anyone show me a way to do this or point me in the right direction for this? I have been working on it for the past 4 hours and can't figure it out. Thx for the help. Quinn Me is very frustrated and pissed off at coding... But that just makes me feel more like a gawd when I beat the computer into submission.
-
I added a tab control to my dialog box using the dialog editor in VC++. I cannot figure out how to add a tab to the control. I have attempted to use TabCtrl_InsertItem(hTemp, 0, &tci); where hTemp is gotten by GetDlgItem(hWndMain, Tab_1); under the WM_INITDIALOG, but the hTemp is always NULL. I can understand this because the control isn't created yey. if I do the same steps using a button to run them, then the tab will show up on the Tab Control. But I need it to show up when the window is created. Can anyone show me a way to do this or point me in the right direction for this? I have been working on it for the past 4 hours and can't figure it out. Thx for the help. Quinn Me is very frustrated and pissed off at coding... But that just makes me feel more like a gawd when I beat the computer into submission.
as a first point, why not follow Joseph Newcomer's advice and never use GetDlgItem (or at least, not again this year). Create a member variable in class wizard to go with your control. He has an article about that on this site. That might take care of all your problems, if we're lucky.:)