S
Steven
Hi,
I have an enterprise application that was originally
written in VC 6.0 C++ as an MFC App. We
wanted to pull some new functionality into it
that is managed, so I now end up with a mixed
application of managed and unmanaged.
Using the MFC tree control I need to store
the managed type.
I put it in like this:
MyManagedType^ mt = gcnew MyMangedType();
m_MyTree.SetItemData(hTreeItemIndex, (DWORD_PTR)&mt);
Now I'm having trouble getting it out:
MyManagedType^ mt =
*(MyManagedType^*)m_DecoderTree.GetItemData(hItem);
//mt is not valid coming out.though it does compile and
//run without errors.
I even took some stabs at Marshal:trToStructure(), but
didn't think I needed to do that, but neither way is working.
Does this have to do with .Net moving it around in memory,
so it's not guaranteed to be in the same place?
How can I assign a managed type to the ItemData and retrieve
it?
Thanks!
I have an enterprise application that was originally
written in VC 6.0 C++ as an MFC App. We
wanted to pull some new functionality into it
that is managed, so I now end up with a mixed
application of managed and unmanaged.
Using the MFC tree control I need to store
the managed type.
I put it in like this:
MyManagedType^ mt = gcnew MyMangedType();
m_MyTree.SetItemData(hTreeItemIndex, (DWORD_PTR)&mt);
Now I'm having trouble getting it out:
MyManagedType^ mt =
*(MyManagedType^*)m_DecoderTree.GetItemData(hItem);
//mt is not valid coming out.though it does compile and
//run without errors.
I even took some stabs at Marshal:trToStructure(), but
didn't think I needed to do that, but neither way is working.
Does this have to do with .Net moving it around in memory,
so it's not guaranteed to be in the same place?
How can I assign a managed type to the ItemData and retrieve
it?
Thanks!