main_wnd_proc (pstruct -w reply, p_program_state -&w state, p_msg msg)
{
  select (msg->message)
  {
    case WM_BUTTON_1_UP, WM_BUTTON_2_UP:
      ...
    return;

    case WM_CHAR:
      ...
    return;

    case WM_PAINT:
      ps = begin_paint (msg->window);
      ...
    +
      free (&ps);
    return;
  }
  else
  {
    ;
  }
}