Please help me
I am trying to port over some old 3rd party code (using XVT), and am using .net via managed c++. All my buttons and edit controls look great. However i can't get a virtual OWNERDATA listview working. I have tried extending the get_CreateParams with the LVS_OWNERDATA style but spy++ does not show that this works, also i never get the WM_NOTIFY message (i have extend the WndProc method). Please can someone tell me what i am doing wrong, it is driving me nuts
Here is my code so far (its a bit messy but i hope shows the problem
#include "windows.h
#include "commctrl.h
#undef MessageBo
__gc class virtualListBox : public System::Windows::Forms::ListView
public
virtualListBox()
FullRowSelect = true
GridLines = true
View = System::Windows::Forms::View::Details
protected: __property virtual System::Windows::Forms::CreateParams* get_CreateParams(
System::Windows::Forms::CreateParams* defParams = System::Windows::Forms::ListView::get_CreateParams ()
defParams->Style = defParams->Style & ~LBS_HASSTRINGS
defParams->Style = defParams->Style & ~LBS_SORT
defParams->Style = defParams->Style | LVS_OWNERDATA | LVS_SHOWSELALWAYS | LVS_SINGLESEL
defParams->ExStyle = defParams->ExStyle | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP
return defParams
public: __property int get_Count()
int value = Handle.ToInt32()
return ::SendMessage( reinterpret_cast<HWND>( value ), LVM_GETITEMCOUNT, 0, 0 )
public: __property void set_Count( int count )
int value = Handle.ToInt32()
::SendMessage( reinterpret_cast<HWND>( value ), LVM_SETITEMCOUNT, count, 0 )
[System::Security::Permissions::PermissionSet(Syste m::Security::Permissions::SecurityAction::Demand, Name="FullTrust")
virtual void WndProc( System::Windows::Forms::Message* m )
// Listen for operating system messages
switch ( m->Msg )
case WM_NOTIFY : {
int value = m->LParam.ToInt32()
NMHDR* pNmhdr = (NMHDR*)value
UINT testCode = LVN_GETDISPINFOA
UINT nCode = ( NULL != pNmhdr ) ? pNmhdr->code : -1
if ( nCode == LVN_GETDISPINFOW || nCode == LVN_GETDISPINFOA )
System::Windows::Forms::MessageBox::Show( S"got here" )
if ( nCode == LVN_ITEMCHANGED )
System::Windows::Forms::MessageBox::Show( S"item changed" )
if ( nCode == LVN_ODCACHEHINT )
System::Windows::Forms::MessageBox::Show( S"a1" )
if ( nCode == LVN_ODFINDITEM )
System::Windows::Forms::MessageBox::Show( S"a2" )
break
case WM_COMMAND
WORD hi = HIWORD( (int)m->WParam )
WORD low = LOWORD( (int)m->WParam )
break
__super::WndProc(m)
}