任何人都知道如何从WndProc调用非静态成员?从WndProc调用非静态成员
这里是我的WndProc原型:
LRESULT CALLBACK System::Windows::Forms::Control::WndProc(HWND hWnd,
UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
this->OnCreate(new EventArgs(hWnd, message, wParam, lParam));
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
break;
}
return 0;
}
而认定中:
class LIBMANAGED_API Control
{
protected:
HWND hWnd;
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
...
};
很难想象这可能已经错了。 WndProc()方法是Control类的一个实例方法。不要试图用原生C++重写Winforms,没有意义。 –