Click here to Skip to main content
16,008,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Handle WM_CHAR in a Dialog Pin
29-May-01 4:18
suss29-May-01 4:18 
GeneralRe: Handle WM_CHAR in a Dialog Pin
29-May-01 4:20
suss29-May-01 4:20 
GeneralRe: Handle WM_CHAR in a Dialog Pin
Hadi Rezaee29-May-01 16:24
Hadi Rezaee29-May-01 16:24 
GeneralActive X controls in Internet Explorer Pin
Jared Allen29-May-01 3:34
Jared Allen29-May-01 3:34 
GeneralRe: Active X controls in Internet Explorer Pin
Michael Dunn29-May-01 9:43
sitebuilderMichael Dunn29-May-01 9:43 
GeneralRe: Active X controls in Internet Explorer Pin
Jared Allen29-May-01 12:33
Jared Allen29-May-01 12:33 
GeneralGet tree item Pin
hearties29-May-01 3:22
hearties29-May-01 3:22 
GeneralRe: Get tree item Pin
MikeG29-May-01 8:13
MikeG29-May-01 8:13 
I think you are thinking about it backwards. It is probably easier to add your data to the TreeView items. You can accomplist this by using the lParam in the TVITEM. Whenever an item is selected, handle the TVN_SELCHANGED message for your treeview and retrieve the data and modify accordingly.
Mike

Some Code follows:

HTREEITEM tvAddItem( HTREEITEM hParent, LPSTR szText,
HTREEITEM hInsAfter, int iImage,
LPVOID pvData ) // pvData would just be your MyStruct *
{
HTREEITEM hItem;
TVITEM tvI = {0};
TVINSERTSTRUCT tvIns = {0};

// The pszText, iImage, and iSelectedImage members are filled out.
// make sure we set the flag for TVIF_PARAM
if( iImage == -1 )
{
tvI.mask = TVIF_TEXT | TVIF_PARAM;
}
else
{
tvI.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
}

tvI.pszText = szText;
tvI.cchTextMax = lstrlen (szText);
tvI.iImage = iImage;
tvI.iSelectedImage = iImage;
tvI.lParam = (LPARAM) pvData;
tvIns.item = tvI;
tvIns.hInsertAfter = hInsAfter;
tvIns.hParent = hParent;

// Insert the item into the tree.
hItem = TreeView_InsertItem( iv_ctlTreeView.m_hWnd, &tvIns );

return( hItem );
}

// update the data from the TreeView in the SELCHANGED event
// selchange WM_NOTIFY, TVN_SELCHANGED
LPNMTREEVIEW pnTree = (LPNMTREEVIEW) lParam;
MyStruct *pMyStruct;

pMyStruct = (MyStruct *) pnTree->itemNew.lParam;

GeneralUsing the web browser object Pin
29-May-01 2:58
suss29-May-01 2:58 
GeneralRe: Using the web browser object Pin
Matt Philmon29-May-01 17:34
Matt Philmon29-May-01 17:34 
GeneralRe: Using the web browser object Pin
Alex Chmakotine4-Jun-01 22:27
Alex Chmakotine4-Jun-01 22:27 
Generalerror C2011: 'LockTypeEnum' : 'enum' type redefinition Pin
Bartek29-May-01 2:54
Bartek29-May-01 2:54 
GeneralRe: error C2011: 'LockTypeEnum' : 'enum' type redefinition Pin
Bartek29-May-01 4:53
Bartek29-May-01 4:53 
GeneralImage size Pin
mr200329-May-01 2:29
mr200329-May-01 2:29 
GeneralRe: Image size Pin
Tomasz Sowinski29-May-01 2:41
Tomasz Sowinski29-May-01 2:41 
QuestionHow do I avoid flickering Pin
Vikas Rao28-May-01 23:47
professionalVikas Rao28-May-01 23:47 
AnswerRe: How do I avoid flickering Pin
Christian Graus29-May-01 0:11
protectorChristian Graus29-May-01 0:11 
GeneralRe: How do I avoid flickering Pin
Vikas Rao29-May-01 1:09
professionalVikas Rao29-May-01 1:09 
GeneralRe: How do I avoid flickering Pin
Christian Graus29-May-01 3:05
protectorChristian Graus29-May-01 3:05 
QuestionHow to disable system-menu at run-time? Pin
petr.me28-May-01 23:27
petr.me28-May-01 23:27 
AnswerRe: How to disable system-menu at run-time? Pin
Christian Graus29-May-01 0:12
protectorChristian Graus29-May-01 0:12 
Generalgraphics animation Pin
Earl Rex Arao-arao28-May-01 17:51
Earl Rex Arao-arao28-May-01 17:51 
GeneralRe: graphics animation Pin
Christian Graus28-May-01 18:14
protectorChristian Graus28-May-01 18:14 
GeneralRe: graphics animation Pin
29-May-01 18:21
suss29-May-01 18:21 

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.