Martin: Perfect, thank you. That will do for this application. Before Rob points it out, lemme say I understand could will produce an unreliable result if Windows switches tasks and another process uses it between the time my control gets and loses focus.
Rob, >>Why have an input control when whatever I enter is going to get canceled? Why does it matter? There's nowhere else to tab to anyway. You haven't told us anything about the problem you're trying to solve. All you've told us is that you think that knowing how a control lost focus will let you solve that problem.<< You do live in an ivory tower sometimes :) ! I said explanations would only cloud the issue, and all I asked was if there was some way to tell if a control was tabbed out of. I'm not looking for the philosopher's stone. Never mind the why and wherefore Clients pay the rent and therefore You admit their jurisdiction and then humbly do your bit Leaving judgement and conviction to the academic... wit. -in respectful jest, from a lowly tar who ploughs the windows. > Hi, > > > I am trying to have a control which knows it has > > been tabbed out of. > > You mean as opposed to any other way of losing focus? > > In the control's OnExit event, use GetAsyncKeyState() to see if the > tab key (VK_TAB) is down. > > regards, > > Martin. > >

