• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

How to set CTreeView properties

Hiya,
 Im trying to set my CTreeView control properties with the code:

SetWindowLongPtr( GetTreeCtrl().m_hWnd, GWL_STYLE, TVS_HASBUTTONS | TVS_CHECKBOXES );


However, it ends up crashing my program somewhere after the call. My CLeftView class owns the control and I tried calling it from the constuctor. Any help would be great.

Thanks,
  jer
0
pipe
Asked:
pipe
1 Solution
 
Vinayak KumbarSr Program ManagerCommented:
Hi,

Try using

long style = GetWindowLong(m_ctrlTree, GWL_STYLE);
SetWindowLong(m_ctrlTree, GWL_STYLE, style | TVS_HASBUTTONS | TVS_CHECKBOXES );

Here m_ctrlTree is the TreeControl object attached to the tree control.

Hope this helps.
VinExpert
0
 
pipeAuthor Commented:
I see, you must retrieve the properties and append, not just add or append new properties.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now