Vor is a tricky little preposition in this context. It can come in two forms.
- As part of a set phrase.
vor der Tür / vor dem Fenster
Always refering to the outside of an enclosed space, typically a room or house, but also a vehicle. - As part of the contrasting pair
vor etwas / hinter etwas
With vor describing something between the observer and a second object and hinter something behind said object.
So regarding your examples:
- 1 and 2: Use vor as the set phrase.
- 3 and 4: The table would be vor the window (between Carl and the window). If Carl described the table as hinter, he would be outside.
- 5: In theory, you could use hinter. My language instinct as native speaker would pick vor - the set phrase taking precedence.