PM_* // WINDOW_TITLE : "The Rectangle Window",
        HELLO_WORLD  : "Hello, World!";

program_state = 
{
  ...
};

>> ()
{
  msg_queue = create_queue ();

  frame, client = create_window (&frame_desc),
  {
    frame_desc = {
                   parent_window : HWND_DESKTOP,
                   client_proc : rect_wnd_proc,
                   wm_mode : ALLOW_READ_WRITE,
                   title : PM_WINDOW_TITLE,
                   flags : FCF_STANDARD,
                   style : WS_VISIBLE
                 }
  };

  msg_in (msg_queue, (pstruct -w reply, p_msg message) { 
                                                         dispatch (reply, &state, message);
                                                       }),
  {
    program_state state = . 
  };
}
/
{
  destroy (&client, &frame); free (&msg_queue);
}

rect_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: 
      alert (PM_HELLO_WORLD, PM_WINDOW_TITLE, frame_window (msg->window));
    return;

    case WM_CHAR:
      if (kbd_msg.scan_code == SC_ESC, { char_msg kbd_msg = decode (&_, msg) }) 
      {
        post_quit_message (message_queue (msg->window));
      }
    return;

    case WM_PAINT:
      ps = begin_paint (msg->window);

      ...

    +
      free (&ps);
    return;
  }
  else
  {
    ;
  }
}