Re: template question.
On Jul 18, 3:54 am, tather <tat...@gmail.com> wrote:
I found these code inhttp://www.parkscomputing.com
but I can not compile it successful.
------------------------------------------------
typedef LONG (__stdcall * forwardFn_t)(HWND, UINT, WPARAM, LPARAM);
template<UINT msg> class Handler;
template<> class Handler<WM_PAINT>
{
protected:
virtual void OnPaint() = 0;
public:
LRESULT Handle(WPARAM wParam, LPARAM lParam)
{
OnPaint();
return 0L;
}
static void Forward(HWND hWnd, forwardFn_t pfn)
{
(*pfn)(hWnd, msg, 0L, 0L);
}
};
----------------------------------------------------
error C2065: 'msg' : undeclared identifier
Why the error occur, and How can I resolve it to get the same fuction?
The error occured (obviously) because there is no symbol msg
declared which is visible in the scope of the function. In
fact, the only symbol msg I see anywhere is as an argument to
the template declaration; since it is a declaration, and not a
definition, the symbol is really only a comment, and not
accessible anywhere.
What did you mean instead of msg? WM_PAINT? Or something else?
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34