He was watching TV when I came in.
I came in when he was watching TV.
As we know, simple or continuous verb forms can be used in when-clauses. It seems the second example is semantically different from the first one. If so, what is the difference between these two examples in usage of "when"?