Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4343072
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:42:03+00:00 2026-05-21T11:42:03+00:00

I am trying to enable/disable checkboxes in treeitems in ctreecntrl of visual c++ 6.0.

  • 0

I am trying to enable/disable checkboxes in treeitems in ctreecntrl of visual c++ 6.0. I have found the options to do that for all items, but couldn’t do that per item basis. Is there any function to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:42:04+00:00Added an answer on May 21, 2026 at 11:42 am

    To turn checkboxes on and off for individual tree items, you need to send TVM_SETITEM messages, which are used to set attributes for items in a TreeView.

    The documentation says the wParam must be zero, and the lParam is a pointer to a TVITEM structure that contains the new item attributes.

    So the real battle is in getting the TVITEM structure filled out accordingly. Here are the important parts:

    • The hItem member must contain the handle to the tree item that you want to modify.
    • The mask member should be set to TVIF_STATE, which indicates that the state and stateMask members are valid. Those are the ones you’ll be using to turn checkboxes on and off.
    • The state member can be set to 0, which will hide the checkbox for the specified tree item.
      To show the checkbox for the tree item, set this member of 1 << 12. (See the docs for details).
    • The stateMask member should be set to TVIS_STATEIMAGEMASK to indicate that you’re changing the item’s state image index.

    Since you’ve set mask to indicate that you’re only using the state and stateMask members, you can happily ignore the rest of the members.

    And finally, once you’ve got the TVITEM structure set, you can either use the standard SendMessage function, or the TreeView_SetItem macro, to send the message to the tree item.

    (Of course, the entire TreeView must have the TVS_CHECKBOXES style set in order for any of the above to work! But you said you already figured out how to do that.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im am trying to add a check box that will enable/disable the edit button.
I'm trying to enable or disable all the control in a window as the
I have a Chrome Extension I'm trying to add features with an enable/disable option.
I'm trying to enable and disable custom buttons on a jqgrid, but would enable
I am trying to enable and disable checkboxes based on selection of checkboxes. If
I'm trying to disable some checkboxes in a TabHost I have. When the app
I am trying to enable and disable a required field validator using javascript but
I am trying to enable and disable a datepicker with a checkbox, but I
I'm trying to disable/enable controls based on user permission using a custom security framework
I'm trying to come up with a solution to programmatically enable/disable the network card

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.