Solved

TabCtrl's TC_ITEM

Posted on 1998-03-28
1
815 Views
Last Modified: 2013-11-20
I insert a CTreeCtrl into a CTabCtrl using the InsertItem() function:

  TC_ITEM TCI;
  TCI.mask = TCIF_PARAM;
  TCI.lParam = (LPARAM)pTreeCtrl;
  VERIFY(m_TabCtrl.InsertItem(0, &TCI) != -1);

I can get a pointer to the treectrl by doing:

  TC_ITEM TCI;
  TCI.mask = TCIF_PARAM;
  m_TabCtrl.GetItem(nTab, &TCI);
  CTreeCtrl * pWnd = (CTreeCtrl *)TCI.lParam;

But i want something like this,  :

  CTreeCtrl &Tree = GetTreefromTabCtrl();

How shall i go about modifying the above code?
0
Comment
Question by:leowlf
1 Comment
 
LVL 7

Accepted Solution

by:
galkin earned 50 total points
ID: 1317313
If you assign to all tab control items the pointer to tree control
1.Add variable m_tree of type CTreeCtrl to the class GetTreefromTabCtrl is member of
2.Add code for the function
CTreeCtrl& CYuorClass::GetTreefromTabCtrl()
{
ASSERT(m_TabCtrl.GetItemCount() > 0);

 TC_ITEM TCI;
  TCI.mask = TCIF_PARAM;
  m_TabCtrl.GetItem(0, &TCI);
  CTreeCtrl * pWnd = (CTreeCtrl *)TCI.lParam;
ASSERT_KINDOF(CTreeCtrl, pWnd);
CopyMemory(&m_tree, pWnd, sizeof(CTreeCtrl));
return m_tree;
}
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question