Take a look at the autodocs: workbench.doc
The WorkbenchControl() function does just what you want.
The tag WBCTRLA_GetSelectedIconList will give you a list of all selected icons for a given drawer (=WB window).
The WBCTRLA_GetOpenDrawerList gives you a list of all open drawers. So you can loop through them and call WBCTRLA_GetSelectedIconList for each one.
This information is not in the Wiki yet. Also the multiple hooks, you can use via ChangeWorkbenchSelection() are not yet described in the Wiki.
Same goes for icon.library, which has got some interesting methods, since 3.5.