Iconifying a window:

Alt-Click close (or other iconification trigger). Wimp broadcasts 'window wants to be iconified' (including window title text strncpyed to fill the event block) Iconification app not there:

        Nothing more happens
Iconification app is there:
        It does Ack the message (stops fights between multiple iconification apps)
        It send an iconification request to the window being iconified
        (Old style) app ignores the message it doesn't understand:
                Iconification app gets message_acknowledge back
                Iconification app sends open window request for window, 
                behind window -3 (at back, and I really mean this! 
                - there has to be at least one full sized back window)
                Iconification app creates iconified window entry somewhere (using app title and window title)
                App receives open request and, hopefully, sends it through cleanly.
        (New style) app picks up iconify request
                (i) App wishes to help the iconify app, but doesn't want to mess about itself.
                        App returns message giving more accurate details for iconification (a sprite and some text)
                        Iconification app sends open window request behind -3
                        Iconification app adds iconified entry
                        App opens window like a good little boy.
                (ii) App does want to mess about iconifying its own windows.
                        App Acks the message
                        Iconification app doesn't get any returned message and does nothing more.
                        App does all messing about iconifying the window.

Iconified window is clicked upon to de-iconify it. Iconification app sends OpenRequest to app.

App opens iconified window
Window opens as requested. If window suddenly appears; sad.

App closes iconified window
Wimp broadcasts 'window closed' message sent from app. Iconification app disposes of iconified window's entry.

App dies:
The windows get closed, hence iconification app gets a stream of window close broadcasts. Iconification app junks iconify entries for that app's windows.

Message spec.

Message_Iconize:

        Sent from wimp when shift+close clicked.
     +20  Window handle.
     +24  Task handle.
     +28  20 Bytes of title string. (last part of first word)
     +48

Message_WindowInfo:

  1. Sent by Iconizer to the task which owns the window.
              +20 Window handle
    
              If window handle is 0, should be ignored.
    
           2. Sent as reply to 1.
    
              +20 Window handle.
              +24 Reserved, must be 0.
              +28 Sprite name to use, null terminated  (MAX = 7 chars + NULL) 
                  name used is icon_<string>
              +36 String to use null terminated (as short as possible 
                  truncated to 20 characters).
    
           3. Broadcast by Iconizer starting up.
    
              +20 0.
    
              Old iconizer, if present should restore all windows, and quit.