Hi Hanuman,
1. Hardly had I sat on the chair when the bell rang.
2. Hardly had I sat on the chair, when the bell rang.
These two sentences are from two different dictionaries. In (1) sentence there is no comma before the word "when" while in (2) there is comma before the word "when".
Why is it so? Both versions seem acceptable to me. A comma can sometimes be optional, depending on the meaning the writer wishes to communicate to the reader.
A comma represents a pause. In speech, a pause after 'chair' breaks the thought into two parts, and gives the listener a moment to think about the first part. This gives the idea, the image, of sitting briefly in a chair more emphasis/importance. If there is no pause, the listener recieves the whole sentence as one thought. This gives the fact that the bell rang more emphasis/importance.
Best wishes, Clive