直接上代码void SongList::Create(HWND &hwnd, DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle,
    int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
{
hwnd = CreateWindowEx(dwExStyle, lpClassName, lpWindowName, dwStyle
, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
OldProc = (WNDPROC)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG)ListBoxProc);
}。LRESULT SongList::ListBoxProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg) 

case WM_LBUTTONDOWN:
MessageBox(NULL, "0", "1", NULL);
break;
default: 
return CallWindowProc(OldProc,hwnd,uMsg,wParam,lParam);  
break; 
}
return 1;
}错误:类型转换问题。
error C2440: 'type cast' : cannot convert from 'long (__thiscall SongList::*)(struct HWND__ *,unsigned int,unsigned int,long)' to '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怎么整,谢谢。

解决方案 »

  1.   

    回调函数的定义有问题
    把SongList::ListBoxProc的返回类型从LRESULT改为UINT试试
      

  2.   

    Conversion is a valid standard conversion, which can be performed implicitly or by use of static_cast, C-style cast or function-style cast转换是一个合法转换,如果使用static_cast或者函数风格的cast~多看看后面的提示~
      

  3.   

    不能用类函数,类函数调用方式是__thiscall,
    SetWindowLong()子类化要求的消息处理函数是__stdcall方式的.
      

  4.   

    将SongList::ListBoxProc声明为static即可。
      

  5.   

    谢谢大家,不过还是没有搞好。纠结ing