Attached is a view where windows are trimmed top and bottom without deleting the window - using two "Trim to roof" commands where a roof was above and below the window line. It is possible that this command CAN destroy a window object.
I am a bit confused by your query because in Archicad windows are always associated with walls and can be included or excluded from the trim action.
If you have a special situation, perhaps you could consider the Solid Element Operation instead.
If your roof trims are oblique and you are trying to create a window with an irregular shape, consider, instead of trimming, a selection from the library: W Slanted Fix 10
Dwight Atkinson