|
|
|
date: Mon, 14 Jul 2008 04:03:02 -0700,
group: microsoft.public.win32.programmer.ui
back
Re: Set focus programmatically without raising to foreground?
On Mon, 14 Jul 2008 04:03:02 -0700, ArchibaldMartel
wrote:
>I would like to set focus to a window with a function call without raising
>that window to the foreground.
The SetFocus function returns a handle that had focus before the
function call. Perhaps you can call SetFocus to show one window, keep
the handle returned by that call, and then use it in a call to
SetFocus that will the original window back in focus.
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com
date: Mon, 14 Jul 2008 13:28:36 -0400
author: unknown
Re: Set focus programmatically without raising to foreground?
Yes, I can restore things to the way they were before the call.
Unfortunately that does not solve my problem. I need to do what I described
in my first message -- set focus without a change in Z-order.
"r_z_aret@pen_fact.com" wrote:
> On Mon, 14 Jul 2008 04:03:02 -0700, ArchibaldMartel
> wrote:
>
> >I would like to set focus to a window with a function call without raising
> >that window to the foreground.
>
> The SetFocus function returns a handle that had focus before the
> function call. Perhaps you can call SetFocus to show one window, keep
> the handle returned by that call, and then use it in a call to
> SetFocus that will the original window back in focus.
>
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 20 Park Plaza, Suite 478
> Boston, MA 02116
> www.penfact.com
>
date: Mon, 14 Jul 2008 10:48:01 -0700
author: ArchibaldMartel
Re: Set focus programmatically without raising to foreground?
> Sounds like you'd be better off with system hooks, although getting
> them working under Vista is more of a problem due to security issues.
Which system hook do you have in mind and how would it help? The program
already has a low-level keyboard hook. So far as I know, there's no way to
use it to direct input to a particular window. Please tell me if I'm wrong.
I would be very happy to be wrong.
What would help me most, I think, is if somebody here knows how
SetActiveWindowTracking is written. As I've said several times in this
thread, it allows the mouse to do what I want to do programmatically. It may
just happen to be the case that SetActiveWindowTracking uses undocumented
functions that I can call from an app. If so, and if somebody can tell me,
my problem would be solved 100%.
"Geoffrey Summerhayes" wrote:
> On Jul 14, 1:55 pm, ArchibaldMartel
> wrote:
> > > What are you trying to do? Perhaps if we had a better idea of that it
> > > would
> > > be easier to suggest an alternate approach.
> >
> > I'm injecting keystrokes into several different windows in very rapid
> > succession with SendInput. This is part of a utility for gamers who play
> > several instances of the same game simultaneously.
> >
> > Timing is very important here. When focus is changed with SetFocus,
> > SetActiveWindow, or SetForegroundWindow, the operating system redraws part of
> > the screen. This is slow enough to be a problem for what I'm trying to do.
> >
> > However, when SetActiveWindowTracking is on and the user changes focus with
> > the mouse, there is practically no redrawing and focus changes faster.
> >
> > I want to do that second sort of focus change programmatically.
> >
> > > It's actually a little frustrating for a user to be not be sure if
> > > their input is not
> > > only correct but even if it is reaching the correct destination.
> >
> > This is not a problem with this application.
>
> Sounds like you'd be better off with system hooks, although getting
> them working under Vista is more of a problem due to security issues.
>
> ----
> Geoff
>
date: Mon, 14 Jul 2008 13:41:00 -0700
author: ArchibaldMartel
Re: Set focus programmatically without raising to foreground?
Is it an option to send input messages like WM_KEYDOWN and
WM_LBUTTONDOWN directly to the control?
ArchibaldMartel wrote:
>> Sounds like you'd be better off with system hooks, although getting
>> them working under Vista is more of a problem due to security issues.
>
> Which system hook do you have in mind and how would it help? The program
> already has a low-level keyboard hook. So far as I know, there's no way to
> use it to direct input to a particular window. Please tell me if I'm wrong.
> I would be very happy to be wrong.
>
> What would help me most, I think, is if somebody here knows how
> SetActiveWindowTracking is written. As I've said several times in this
> thread, it allows the mouse to do what I want to do programmatically. It may
> just happen to be the case that SetActiveWindowTracking uses undocumented
> functions that I can call from an app. If so, and if somebody can tell me,
> my problem would be solved 100%.
>
> "Geoffrey Summerhayes" wrote:
>
>> On Jul 14, 1:55 pm, ArchibaldMartel
>> wrote:
>>>> What are you trying to do? Perhaps if we had a better idea of that it
>>>> would
>>>> be easier to suggest an alternate approach.
>>> I'm injecting keystrokes into several different windows in very rapid
>>> succession with SendInput. This is part of a utility for gamers who play
>>> several instances of the same game simultaneously.
>>>
>>> Timing is very important here. When focus is changed with SetFocus,
>>> SetActiveWindow, or SetForegroundWindow, the operating system redraws part of
>>> the screen. This is slow enough to be a problem for what I'm trying to do.
>>>
>>> However, when SetActiveWindowTracking is on and the user changes focus with
>>> the mouse, there is practically no redrawing and focus changes faster.
>>>
>>> I want to do that second sort of focus change programmatically.
>>>
>>>> It's actually a little frustrating for a user to be not be sure if
>>>> their input is not
>>>> only correct but even if it is reaching the correct destination.
>>> This is not a problem with this application.
>> Sounds like you'd be better off with system hooks, although getting
>> them working under Vista is more of a problem due to security issues.
>>
>> ----
>> Geoff
>>
date: Mon, 14 Jul 2008 21:14:25 -0700
author: Ivo Beltchev
Re: Set focus programmatically without raising to foreground?
Not quite the same question, but you might check a current thread
called "Restore a window WITHOUT activation" in this newsgroup.
On Mon, 14 Jul 2008 04:03:02 -0700, ArchibaldMartel
wrote:
>I would like to set focus to a window with a function call without raising
>that window to the foreground.
>
>It is possible to make this behavior happen by moving the mouse if
>SetActiveWindowTracking is on, so Windows is capable of doing it. The
>question is, is there a way for an application to do it by calling a function?
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com
date: Wed, 16 Jul 2008 11:22:51 -0400
author: unknown
|
|