Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Adding Tabs to a Tab Control

Adding Tabs to a Tab Control

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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.

    T 1 Reply Last reply
    0
    • L Lost User

      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.

      T Offline
      T Offline
      Todd Harvey
      wrote on last edited by
      #2

      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.:)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups