In case hooking is too much (it gets all the messages from the system, not only from the window you need) The more proper technique (since the time of the first Petzold!) is
subclassing:
just write something like:
WNDPROC oldproc;
LRESULT CALLBACK yourproc(HWND h, UINT u, WPARAM w, LPARAM l)
{
return CallWindowProc(oldproc,h,u,w,l);
}
and setup the subclassing as
oldproc = (WNDPROC)SetWindowLongPtr(yourHwnd, GWL_WNDPROC, (LONG_PTR)yourproc);
and from there,
yopuproc
will start receiving th messages of your window.