Hardly … When
- I had hardly closed my eyes when the phone rang.
- I had hardly closed the door before somebody knocked.
- I had hardly reached the station when the train steamed out.
In a formal or literary style, the structure is sometimes used with an inverted word order.
- Hardly had I closed my eyes when the phone rang.
- Hardly had I closed the door before somebody knocked.
- Hardly had I sat for dinner when the telephone rang.