One trick is to provide a separate overload:
void f(char c);
which makes calls with a literal 0 ambiguous. The overload doesn't need an implementation. You'd have to specify f((CWnd*)0) to pick the correct overload if needed.
However, I would not recommend to use that. It's of questionable value, since it wouldn't even catch:
CWnd * wnd = 0;
f(wnd);
(which can't be caught - at least not easily - at compile time).
A simple ASSERT within f() should do the trick - or pass a reference, as suggested.