From: JoDeGr8 on
Hi,

I created a popup(Modal dlg)panel which will be shown from the system
tray when user types certain character. The problem is that when this
popup panel shows up it is getting focus. This is undesirable in the
case when user is typing some text in an editor and the editor looses
focus because of the popup panel. What can i do to create this popup
panel so that it wont get focus while it get showed up. Also, please
tell me a way to remove the button created in the taskbar for this
popup panel.

I have given CHILD property to the dialog.

Thanks in advance.

Regards,
Joe.
From: Victor Bazarov on
JoDeGr8 wrote:
> I created a popup(Modal dlg)panel which will be shown from the system
> tray when user types certain character. The problem is that when this
> popup panel shows up it is getting focus. This is undesirable in the
> case when user is typing some text in an editor and the editor looses
> focus because of the popup panel. What can i do to create this popup
> panel so that it wont get focus while it get showed up. Also, please
> tell me a way to remove the button created in the taskbar for this
> popup panel.

This is more of a Windows programming question, not a language question,
is it? Well, I'd solve it simply by *not* making the popup a modal
dialog. Make it a simple popup window. And if it does gain focus, it
can learn what window the focus came from (IIRC it is part of the
activation message the window receives), so it can force the focus back
to that window... Generally, though, you just create a window without
making it active, and it won't gain focus...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
From: Tamas Demjen on
JoDeGr8 wrote:
> Also, please
> tell me a way to remove the button created in the taskbar for this
> popup panel.

If you don't want your application to show up on the taskbar, create an
invisible window and make that your main window's parent:
http://www.codeproject.com/KB/docview/notaskbaricon.aspx

Another option is to set the main window's ExStyle to WS_EX_TOOLWINDOW
instead of WS_EX_APPWINDOW. That way it doesn't even show up in the
Alt+Tab sequence.

Regarding your dialog stealing focus, the WS_EX_NOACTIVATE flag should
prevent your top-level window from stealing focus (according to MSDN).

To do this, go to your .rc file, find the dialog resource, and make sure
to add the EXSTYLE line as shown below:

IDD_MY_DIALOG DIALOG 0, 0, 300, 200
STYLE WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_NOACTIVATE
BEGIN
...
END

If you don't have a resource, then ExStyle is specified in
CreateWindowEx:
http://msdn.microsoft.com/en-us/library/ms632680%28VS.85%29.aspx

In MFC you would typically override the PreCreateWindow function and
set cs.dwExStyle = WS_EX_NOACTIVATE. In .NET it's even easier, just
override ShowInTaskbar = false and ShowWithoutActivation = true.

Don't use SetWindowLong to set WS_EX_NOACTIVATE. It's probably too
late. You should set this flag at creation time.

Tom
From: Faisal on
On Jan 12, 1:15 pm, JoDeGr8 <johnemma...(a)gmail.com> wrote:
> Hi,
>
> I created a popup(Modal dlg)panel which will be shown from the system
> tray when user types certain character. The problem  is that when this
> popup panel shows up it is getting focus. This is undesirable in the
> case when user is typing some text in an editor and the editor looses
> focus because of the popup panel. What can i do to create this popup
> panel so that it wont get focus while it get showed up. Also, please
> tell me a way to remove the button created in the taskbar for this
> popup panel.
>
> I have given CHILD property to the dialog.
>
> Thanks in advance.
>
> Regards,
> Joe.

Paul DiLascia answered this question here
Create a Dialog while Keeping it off that Pesky Taskbar
http://msdn.microsoft.com/en-us/magazine/cc301403.aspx
From: JoDeGr8 on
Thanks everyone who responded... was away from computers for couple of
days.

On Jan 14, 9:20 am, Faisal <faisal...(a)gmail.com> wrote:
> On Jan 12, 1:15 pm,JoDeGr8<johnemma...(a)gmail.com> wrote:
>
>
>
> > Hi,
>
> > I created a popup(Modal dlg)panel which will be shown from the system
> > tray when user types certain character. The problem  is that when this
> > popup panel shows up it is getting focus. This is undesirable in the
> > case when user is typing some text in an editor and the editor looses
> > focus because of the popup panel. What can i do to create this popup
> > panel so that it wont get focus while it get showed up. Also, please
> > tell me a way to remove the button created in the taskbar for this
> > popup panel.
>
> > I have given CHILD property to the dialog.
>
> > Thanks in advance.
>
> > Regards,
> > Joe.
>
> Paul DiLascia answered this question here
> Create a Dialog while Keeping it off that Pesky Taskbarhttp://msdn.microsoft.com/en-us/magazine/cc301403.aspx