Click here to Skip to main content
15,917,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I need a equation thingy Pin
Jörgen Sigvardsson24-Mar-03 0:46
Jörgen Sigvardsson24-Mar-03 0:46 
QuestionKillTimer() inside a TimerProc? Pin
Moak22-Mar-03 16:27
Moak22-Mar-03 16:27 
AnswerRe: KillTimer() inside a TimerProc? Pin
567890123423-Mar-03 1:42
567890123423-Mar-03 1:42 
GeneralRe: KillTimer() inside a TimerProc? - thx Pin
Moak23-Mar-03 13:20
Moak23-Mar-03 13:20 
QuestionSHFileOperation: making new folders? Pin
IGx8922-Mar-03 15:34
IGx8922-Mar-03 15:34 
AnswerRe: SHFileOperation: making new folders? Pin
Ravi Bhavnani23-Mar-03 9:52
professionalRavi Bhavnani23-Mar-03 9:52 
GeneralBubble Tool Tips Pin
Stober22-Mar-03 11:18
Stober22-Mar-03 11:18 
GeneralRe: Bubble Tool Tips Pin
Neville Franks22-Mar-03 11:21
Neville Franks22-Mar-03 11:21 
GeneralRe: Bubble Tool Tips Pin
Ancient Dragon22-Mar-03 11:52
Ancient Dragon22-Mar-03 11:52 
GeneralRe: Bubble Tool Tips Pin
Eugene Pustovoyt23-Mar-03 4:48
Eugene Pustovoyt23-Mar-03 4:48 
GeneralRe: Bubble Tool Tips Pin
Ancient Dragon23-Mar-03 7:34
Ancient Dragon23-Mar-03 7:34 
GeneralCreating VC6 compatible library with VC7 Pin
Mikko Mononen22-Mar-03 10:14
Mikko Mononen22-Mar-03 10:14 
Generalusing CTreeCtrl with a CObArray Pin
Colin Davidson22-Mar-03 8:02
Colin Davidson22-Mar-03 8:02 
GeneralRe: using CTreeCtrl with a CObArray Pin
MAAK22-Mar-03 9:09
MAAK22-Mar-03 9:09 
GeneralRe: using CTreeCtrl with a CObArray Pin
Colin Davidson22-Mar-03 9:22
Colin Davidson22-Mar-03 9:22 
GeneralRe: using CTreeCtrl with a CObArray Pin
MAAK22-Mar-03 10:11
MAAK22-Mar-03 10:11 
Pardon me, I cannot undestand this line of code (do not know what is the type of versionPtr).

To demonstrate, I will assume that versionPtr is an object of type CMyObject and the member function GetVersionLabel() returns a string of that object contents. And finally that we have a CObArray named objArr containing objects of type CMyObject.

Using this assumption, this is how to link the tree items to the array:

int arrIndex;  //this should hold the index of the object
.
.
//inserting the object number [arrIndex] into the tree
CMyObject * pMyObj = (CMyObject *)objArr.GetAt(arrIndex);
HTREEITEM hItem = m_tTreeCtrl.InsertItem(pMyObj->GetVersionLabel());
//now we set the item's data
//BTW, DWORD is a #define for usigned int
m_tTreeCtrl.SetItemData(hItem, (DWORD)arrIndex);
//now the data is set
//next is how to retreive it
.
.
CMyObject * pMyObj;
//where hItem is the handle of the tree item
int index = (int)m_tTreeCtrl.SetItemData(hItem);
pMyObj = (CMyObject *)objArr.GetAt(index);


This sample store the index of the object in the array, a better approach is to store the address of the object itself. In this case, the item data set line would be:
m_tTreeCtrl.SetItemData(hItem, (DWORD)pMyObj);

and the item data retreival line would be:
pMyObj = (CMyObject *)objArr.m_tTreeCtrl.SetItemData(hItem);


I hope that is what you want.
GeneralRe: using CTreeCtrl with a CObArray Pin
Colin Davidson22-Mar-03 10:25
Colin Davidson22-Mar-03 10:25 
GeneralWM_CTLCOLORSTATIC handler blacks checkboxes Pin
Jared McIntyre22-Mar-03 7:58
Jared McIntyre22-Mar-03 7:58 
Generalhelp needed for crystal edit Pin
cerb-dk22-Mar-03 7:26
cerb-dk22-Mar-03 7:26 
GeneralOutlook style listview control Pin
Kuniva22-Mar-03 4:49
Kuniva22-Mar-03 4:49 
GeneralRe: Outlook style listview control Pin
valikac22-Mar-03 6:35
valikac22-Mar-03 6:35 
GeneralRe: Outlook style listview control Pin
Anonymous22-Mar-03 13:08
Anonymous22-Mar-03 13:08 
GeneralCharts Pin
d.f22-Mar-03 4:41
d.f22-Mar-03 4:41 
GeneralRe: Charts Pin
Nish Nishant22-Mar-03 4:45
sitebuilderNish Nishant22-Mar-03 4:45 
GeneralRe: Charts Pin
d.f22-Mar-03 4:48
d.f22-Mar-03 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.