Im using a dialog, and when it loses focus and gets focus back, it doesnt set the keyboard focus back to where it was before. I thought i could use WM_KILLFOCUS to save the control its going from, but it only give you the control its going to. Anyway i could do this?
Posted on 2002-02-26 00:28:08 by ChimpFace9000
Dude, i hacked at that one for you for about and hour or so and got no where!

There is WM_NEXTDLGCTL that will tell you what the next tabstop is...

I was trying to set up basically the same idea (but WM_KILLFOCUS is still no help ~ as you said ). The problem i see is there is no *known* message being sent. There is another process handling the focus events for dialogs (from trial and error ~ tabstops dont generate any events using these three WM's )

Kinda sux, cause it should be a simple task to achieve.

Perhaps some else can hack it?
Posted on 2002-02-27 09:20:28 by NaN
What about monitoring WM_NOTIFY for the
NM_KILLFOCUS message, and record the control that
last had focus?

Posted on 2002-02-27 16:08:16 by farrier
if WA_INACTIVE hlast= GetFocus
if WA_ACTIVE SetFocus(hlast)
Posted on 2002-02-27 19:30:40 by The Svin
Thanx Svin... works great :)

This one peaked my interest a bit, as it was a simple idea, but couldnt get it to work.

For ChimpFace9000 and anyone else, here is working MASM of basically what Svin suggested:
     .elseif   uMsg == WM_ACTIVATE

mov eax, wParam
and eax, 0FFFFh

.if( eax == WA_INACTIVE )
invoke GetFocus
mov FocusedItem, eax

.elseif( (eax == WA_ACTIVE) || (eax == WA_CLICKACTIVE) )
invoke SetFocus, FocusedItem


I should have read Svin's post more closely, cause from my last attempt, i read the API doc on WM_ACTIVATE, and mis-understood it's use and was trying to make use of the window handles being passed in 'lParam' of this message (which of course will never work). Then i woke up to what its purpose is for and got it working.

Coming back, i see in your reply you DID place Get/Set focus after all.... D o H ! :grin:

Oh well, now i know.. :tongue:
Posted on 2002-03-03 22:45:34 by NaN