-
May 22nd, 2014, 06:32 PM
#1
how do i set the focus after an alt+tab?
Using mfc I have an application where I'm not allowed to use a mouse and alt+tab will be regularly used. Using alt+tab to come back to my application kills the focus in the view. Once my application comes back to the foreground how can I set the view as the focus? Thanks for taking the time to help.
Greg
-
May 23rd, 2014, 07:16 AM
#2
Re: how do i set the focus after an alt+tab?
You could try handling WM_ACTIVATE or WM_ACTIVATEAPP and setting the focus yourself. Where's the focus going if not to your view?
-
May 23rd, 2014, 08:35 AM
#3
Re: how do i set the focus after an alt+tab?
I was going to say the same: if your view loses focus when you alt-tab twice there is probably something wrong with the rest of your code.
Basically, the app should come back up without any focus changes at all.
Nobody cares how it works as long as it works
-
May 23rd, 2014, 09:55 AM
#4
Re: how do i set the focus after an alt+tab?
Yes... I'm sure there are lots of things wrong with the code as its been passed around for a couple years. To use the Wm-activate message would i just set the focus in the setactivewindow() function?
Oh oh oh! The code had also been in the hands of the government so ya... Pretty bad code lol.
OK I'm using OnSetFocus() to set the focus of the view but even though the view has the focus it still won't take any keyboard input...
OK WM_ACTIVATE worked thank you very much. I thought OnSetFocus() would but I guess not.
Last edited by Gregorina; May 23rd, 2014 at 01:02 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|