Dialog based app doesn't get focus when restored 
Author Message
 Dialog based app doesn't get focus when restored

Hi all

I have a simple dialog based application that starts minimized and shows
when the user press a hotkey defined in a keyboard hook. My problem is that
I can't give focus to the window app when it's restored.

I use this line of code to retore the window:

    SetWindowPos(&wndTopMost,0,0,size.cx,size.cy,SWP_SHOWWINDOW);

but only shows the window, doesn't activate it (the appbar is gray), so the
keyboard inputs go to the last seen window. I tried with SetFocus and
SetForegroundWindow after that, but none of them works.

Can anybody help me to show the window with focus on it, please?



Sat, 07 May 2005 00:26:17 GMT  
 Dialog based app doesn't get focus when restored
Yes, I tried this but the result is the same, my window doesn't activate.



Quote:

> Have you tried the SetActiveWindow() method ?

> Ben

> >-----Original Message-----
> >Hi all

> >I have a simple dialog based application that starts
> minimized and shows
> >when the user press a hotkey defined in a keyboard hook.
> My problem is that
> >I can't give focus to the window app when it's restored.

> >I use this line of code to retore the window:

> >    SetWindowPos
> (&wndTopMost,0,0,size.cx,size.cy,SWP_SHOWWINDOW);

> >but only shows the window, doesn't activate it (the
> appbar is gray), so the
> >keyboard inputs go to the last seen window. I tried with
> SetFocus and
> >SetForegroundWindow after that, but none of them works.

> >Can anybody help me to show the window with focus on it,
> please?

> >.



Sat, 07 May 2005 16:51:00 GMT  
 Dialog based app doesn't get focus when restored
Try SetForegroundWindow
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> Hi all

> I have a simple dialog based application that starts minimized and
shows
> when the user press a hotkey defined in a keyboard hook. My problem is
that
> I can't give focus to the window app when it's restored.

> I use this line of code to retore the window:

>     SetWindowPos(&wndTopMost,0,0,size.cx,size.cy,SWP_SHOWWINDOW);

> but only shows the window, doesn't activate it (the appbar is gray),
so the
> keyboard inputs go to the last seen window. I tried with SetFocus and
> SetForegroundWindow after that, but none of them works.

> Can anybody help me to show the window with focus on it, please?



Mon, 09 May 2005 02:51:57 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dialog based app doesn't get focus when restored

2. Restoring a dialog's last focus

3. Restoring a dialog's last focus

4. Resizing a dialog based app based on its view's size

5. PopUp Menu doesn't close when app loses focus

6. Keeping focus on a Dialog Box based app

7. dialog doesn't get focus

8. Getting the focus onto dialog's Activex controls

9. Getting a wait cursor in dialog-based app

10. OnIdle not getting called in dialog based app.

11. creating pop-up menus with dialog based apps gets assert error

12. How can I tell when a dialog based app gets hidden or exposed

 

 
Powered by phpBB® Forum Software