I have a dialog box and there is a edit box inside. Since I want to process the wm_vscroll event, I subclassed the edit box. However, the compiler keeps giving errors of my subclass procedure:

error C2440: 'type cast' : cannot convert from 'LRESULT (__stdcall CDialogMain::* )(HWND,UINT,WPARAM,LPARAM)' to 'LONG'

I changed the return type of the subclassed proc to LONG but doesn't help.

Here is some of my code:

Code:
BOOL CALLBACK CDialogMain::staticDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){

	if (msg == WM_INITDIALOG) {
		SetWindowLong(hwnd, GWL_USERDATA, (LONG)lParam);
	}

	LONG self = GetWindowLong(hwnd, GWL_USERDATA);
	
        if (!self) return FALSE;

        // I do it in this way so that my dialog proc can access class members
	return ((CDialogMain*)self)->dialogProc(hwnd, msg, wParam, lParam);

}

// a dialog proc which can access class members
BOOL CDialogMain::dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){

	switch (msg)
	{
		case WM_INITDIALOG:
		{
			originalProc = (WNDPROC)SetWindowLong(GetDlgItem(hwnd, IDC_EDIT_BOX), GWL_WNDPROC, (LONG)editboxProc);
.........
}

//subclassed editbox proc in order to process scroll bar events
LRESULT CALLBACK CDialogMain::editboxProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case WM_VSCROLL:
                //do something
		break;
	}	
	return CallWindowProc(originalProc, hwnd, msg, wParam, lParam);
	
}
Can anyone give me some guide?

Thanks a lot.