WNDPROC procOld; LRESULT CALLBACK NewAcadWndProc( HWND hwnd, // handle to window UINT uMsg, // message identifier WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); class CmyToolbar2App : public AcRxArxApp { public: LRESULT CALLBACK NewAcadWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch(iMsg) { case WM_MOUSEMOVE: //lParam = MAKELPARAM(200,200);//禁止移动光标 break; case WM_LBUTTONDOWN: AfxMessageBox("WM_LBUTTONDOWN");//响应鼠标左键 break; case WM_MOUSEWHEEL: AfxMessageBox("WM_MOUSEWHEEL");//响应鼠标滚动 break; default: break; } return ::CallWindowProc(procOld, hwnd, iMsg, wParam, lParam); } CmyToolbar2App () : AcRxArxApp () {} virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) { AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ; procOld = (WNDPROC)::SetWindowLong(acedGetAcadDwgView()->GetSafeHwnd(),GWL_WNDPROC, (LONG)NewAcadWndProc); CAcModuleResourceOverride resOverride; return (retCode) ; } } ; 这一行有错误: procOld = (WNDPROC)::SetWindowLong(acedGetAcadDwgView()->GetSafeHwnd(),GWL_WNDPROC, (LONG)NewAcadWndProc); CAcModuleResourceOverride resOverride; 包错信息: e:\AutoCAD二次开发\我的演示\myToolbar2\acrxEntryPoint.cpp(96) : error C2440: “类型转换” : 无法从“LRESULT (__stdcall CmyToolbar2App::* )(HWND,UINT,WPARAM,LPARAM)”转换为“LONG” 转换是有效的标准转换,可以隐式执行或通过使用 static_cast、C 样式转换或函数样式转换执行 相似的回掉函数在MFC工程中却没有报错
|