There often isn't much difference in meaning other than the fact that "while" is more suggestive of duration (i.e. during an activity) and "when" refers to an act or event (i.e. at a particular time). Thus, you will frequently find a continuous tense used with "while" (while you were sleeping/while you are working), and a simple tense with "when" (wh