PreTranslateMessage

Hiya

Is there any way of knowing which control in a dialog has the focus from within PreTranslateMessage?

John
IssacJonesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
I think this should do it (hope it is spelt correctly)
UINT nID = GetFocus()->GetDlgCtrlID();
0
IssacJonesAuthor Commented:
Thanks Andy, could you possibly help with a related part of the question, is there a way of knowing if the control is the last control in the dialog i.e. when you press Ctrl+D you see a numerical order for the controls. Using your code how to I see if the control that has the focus is the control with the highest number i.e. the last control in the sequence?

Thanks

John
0
AndyAinscowFreelance programmer / ConsultantCommented:
I don't know if there is a windows function to get the index in the tab order.
This hack might work:
In the OnInitDialog:
PrevDlgCtrl();  //move to last in tab order - on first initially
nIDLastInTabSequence = GetFocus()->GetDlgCtrlID();  //get the ID of last in tab order
NextDlgCtrl();  //Reset focus to first in tab order
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IssacJonesAuthor Commented:
Hiya Andy

Great suggestions as always.

John
0
AndyAinscowFreelance programmer / ConsultantCommented:
:-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.