How to call a function defined in fvwm when a window X is opening or closing?

How to call a function defined in fvwm, when a window X is opening or closing?