Solved

TabCtrl's TC_ITEM

Posted on 1998-03-28
1
811 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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now