One of these might help: (I searched Google for "C++ pointer to member function")
http://www.parashift.com/c++-faq-lite/pointers-to-members.html http://linuxquality.sunsite.dk/articles/memberpointers/ http://www.function-pointer.org/fpt.html http://www.codeproject.com/cpp/FastDelegate.asp > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Palmer, Jean L. > Sent: Friday, July 09, 2004 2:06 PM > To: [EMAIL PROTECTED] > Subject: [msvc] SetItemData to member function ptr > > > 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_b> eginthread.com > for subscription changes, and list archive. > _______________________________________________ msvc mailing list [EMAIL PROTECTED] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
