Board index » delphi » Activate a window (not SetForegroundWindow)

Activate a window (not SetForegroundWindow)

Hello,
I have a probleme, I want to active a window but that doesn't work with the
SetForegroundWindow API function...
This function highlight the title app in the taskbar...
The ActivateWindow function just work in the current application (current
thread caller).

I search with messages... (wm...focus, wm_activate etc.)
But I don't find...
I want that the window become active like if I click on...
It must get the focus.

Please help-me :)

JC

 

Re:Activate a window (not SetForegroundWindow)


In article <396a3...@news-uk.onetel.net.uk>
"Bos J-Christophe (JC`zic)" <jc...@jcrun.com> wrote:

Quote
> This function highlight the title app in the taskbar...

Which OS?

Frank Heyne

Re:Activate a window (not SetForegroundWindow)


"Bos J-Christophe (JC`zic)" <jc...@jcrun.com> wrote in message
news:396a329b@news-uk.onetel.net.uk...

Quote
> Hello,
> I have a probleme, I want to active a window but that doesn't work with
the
> SetForegroundWindow API function...
> This function highlight the title app in the taskbar...
> The ActivateWindow function just work in the current application (current
> thread caller).

M$ changed the behaviour of the SetForegroundWindow function in NT 2000 and
Win98.
See M$ article "INFO: SetActiveWindow() and SetForegroundWindow()
Clarification" (Article ID: Q97925). You can find it at
http://support.microsoft.com/support/kb/articles/q97/9/25.asp

Personally, I think M$ was right to change the behavior of
SetForegroundWindow.  IMHO, there is nothing more annoying then having some
app popup in your face while you are working on something else.  I use this
API routine only when performing COM Drag and Drop, where I think its use is
justified.  As one other developer put it:

The real solution is to abide by the (new) rules for SetForegroundWindow:
"Windows NT 5.0 and later, Windows 98: The system restricts which
processes can set the foreground window. A process can set the
foreground window only if one of the following conditions is true:
The process is the foreground process.
The process was started by the foreground process.
The process received the last input event. There is no foreground process.
The foreground process is being debugged.
The foreground lock time-out has expired (see SystemParametersInfo).
Windows NT 5.0 and later: No menus are active.

Quote

> I search with messages... (wm...focus, wm_activate etc.)
> But I don't find...

Why didn't you try SetForegroundWindow??  If you had you would have found
alot of messages regarding this function.

If you really want to do it, then see the following newsgroup articles
(they'll be archived on Deja)

Re: how to get Setforegroundwindow to work?  (Yorai Aminov
borland.public.delphi.winapi 1999/02/11)

Re: Activating foreign app (Yorai Aminov borland.public.delphi.winapi
1999/01/23 )

Re: Show Dialog with Focus  (David Lowndes microsoft.public.vc.mfc
1999/03/30).

F. Hovey

Re:Activate a window (not SetForegroundWindow)


Ok Thanks :))

JC

Fred Hovey a crit dans le message ...

Quote

>"Bos J-Christophe (JC`zic)" <jc...@jcrun.com> wrote in message
>news:396a329b@news-uk.onetel.net.uk...
>> Hello,
>> I have a probleme, I want to active a window but that doesn't work with
>the
>> SetForegroundWindow API function...
>> This function highlight the title app in the taskbar...
>> The ActivateWindow function just work in the current application (current
>> thread caller).

>M$ changed the behaviour of the SetForegroundWindow function in NT 2000 and
>Win98.
>See M$ article "INFO: SetActiveWindow() and SetForegroundWindow()
>Clarification" (Article ID: Q97925). You can find it at
>http://support.microsoft.com/support/kb/articles/q97/9/25.asp

>Personally, I think M$ was right to change the behavior of
>SetForegroundWindow.  IMHO, there is nothing more annoying then having some
>app popup in your face while you are working on something else.  I use this
>API routine only when performing COM Drag and Drop, where I think its use
is
>justified.  As one other developer put it:

>The real solution is to abide by the (new) rules for SetForegroundWindow:
>"Windows NT 5.0 and later, Windows 98: The system restricts which
>processes can set the foreground window. A process can set the
>foreground window only if one of the following conditions is true:
>The process is the foreground process.
>The process was started by the foreground process.
>The process received the last input event. There is no foreground process.
>The foreground process is being debugged.
>The foreground lock time-out has expired (see SystemParametersInfo).
>Windows NT 5.0 and later: No menus are active.

>> I search with messages... (wm...focus, wm_activate etc.)
>> But I don't find...

>Why didn't you try SetForegroundWindow??  If you had you would have found
>alot of messages regarding this function.

>If you really want to do it, then see the following newsgroup articles
>(they'll be archived on Deja)

>Re: how to get Setforegroundwindow to work?  (Yorai Aminov
>borland.public.delphi.winapi 1999/02/11)

>Re: Activating foreign app (Yorai Aminov borland.public.delphi.winapi
>1999/01/23 )

>Re: Show Dialog with Focus  (David Lowndes microsoft.public.vc.mfc
>1999/03/30).

>F. Hovey

Other Threads