hport _ = create_port (&listener),
{
  listener = {
               port_message_filter : (text_box) <> {
                                                     ...
                                                   }
             }
};

post_message (port, WM_EVENT, event_id, 0);