Solved

TabCtrl's TC_ITEM

Posted on 1998-03-28
1
831 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

615 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