VC++ 6.0

I am trying to assign the value of the address of a function to an item in a list 
control by using SetItemData. The compiler isn't cooperating.  I've tried some 
different casts for the function address value but can't get any to work.

class CMyClass
{
        CString GetValue(int i);
};

// in a (different) class derived from CListView:
        CListCtrl& ListCtrl = GetListCtrl();
        CString (CMyClass::*fp)(int) = CMyClass::GetValue;      // ptr to function 
definition
        ListCtrl.SetItemData(1, static_cast<DWORD>(fp));        // <- error


// error is:
error C2440: 'reinterpret_cast' : cannot convert from 'class CString (__thiscall 
CMyClass::*)(int)' to 'unsigned long'
        Conversion is a valid standard conversion, which can be performed implicitly 
or by use of static_cast, C-style cast or function-style cast

Jean Palmer
Northrop Grumman
> * [EMAIL PROTECTED]
> * (410-993-2627)
> 
> 

_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription 
changes, and list archive.

Reply via email to