D
Dirk
Hello
I override the WndProc method of a control-derived class and want to handle
the WM_NOTIFY message. The following code leads to a NMHDR pointer that
points to something where all members are shown as undefined in the
debugger.
NMHDR __nogc *pnmh = static_cast<NMHDR __nogc*>(msg->LParam.ToPointer());
if I redefine NMHDR as a __gc struct and do the following everything works
gc_NMHDR __gc *pnmh = __try_cast<gc_NMHDR
__gc*>(Marshal:trToStructure(msg->LParam, __typeof(gc_NMHDR)));
now pnmh points to struct with valid members. PtrToStructure's purpose is it
to get the data from the unmanaged heap to the managed heap. Why does the
first method fail then?
I'd like to avoid redefining the native structs and want to use the first
method.
Thanks
I override the WndProc method of a control-derived class and want to handle
the WM_NOTIFY message. The following code leads to a NMHDR pointer that
points to something where all members are shown as undefined in the
debugger.
NMHDR __nogc *pnmh = static_cast<NMHDR __nogc*>(msg->LParam.ToPointer());
if I redefine NMHDR as a __gc struct and do the following everything works
gc_NMHDR __gc *pnmh = __try_cast<gc_NMHDR
__gc*>(Marshal:trToStructure(msg->LParam, __typeof(gc_NMHDR)));
now pnmh points to struct with valid members. PtrToStructure's purpose is it
to get the data from the unmanaged heap to the managed heap. Why does the
first method fail then?
I'd like to avoid redefining the native structs and want to use the first
method.
Thanks