Re: How to get around new limitations on SetForegroundWindow()?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dean Roddey (droddey_at_charmedquark.com)
Date: 03/21/04


Date: Sun, 21 Mar 2004 12:41:16 -0800


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:uQsPJkwDEHA.3064@tk2msftngp13.phx.gbl...
> I don't quite understand your problem. Do you need to make your app window
> foreground at some events? Is it user interface window?
>
> If I understand correctly, your apps interact by simulating user input? It
> is not the proper method for industrial grade app. Use other, more
reliable,
> IPC means, such as named pipes, DCOM, etc.
>

No, my system is a control and automation system. One of the things it needs
to control are applications which are, unfortunately, not designed for such.
So, the only way to control them is to simulate user input into them. Since
my system is network distributed, the 'device' driver that is controlling a
given application can be on one host while the app to be controlled is on
another, so there is a 'proxy' server program (which is a GUI program)
running on each host where my user wants to control applications. The driver
for a given application will connect to the proxy on the host it is told to,
and will pass through commands to the proxy server telling it to start,
stop, send keys to, etc... that particular application.

The problem is that the proxy server program is not being directly
interacted with by the user, it will just be his 'reprsentative' on that
host to start and manipulate the applications, and therefore won't be the
active application on that host. This raises the issue of how to make
another application come forward, so that it can be fed input via
SendInput(), given the limitations of SetForegroundWindow(), which requires
that only a current foreground app can bring other apps to the foreground.
It can delegate that authority in a one shot manner via the
AllowSetForegroundWindow() method, but that won't work here since the actual
foreground app that the user is interacting with is on one machine (in many
cases) while the proxy is running on another machine and doing things to the
controlled application via faked input.

Does that make more sense? I definitely use IPC for everything else, and I
have my own ORB actually, so the entire system is based on my own
distributed object technology. But in this case, it's one of those deals
where you just have to hold your nose against the stink and do what you ahve
to do, and users demand that I be able to control applications that were
never designed to be controlled.



Relevant Pages

  • Re: Opinion wanted
    ... the details including the nature of my own app (which you mischaraterized ... correct the current control (provided that control is invalid but invalid ... causes you to validate controls that have already been ... largely discreditted for good reason and has very little use these days. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Honestly Curious
    ... Mac apps do not need this. ... you don't have to run an app at all. ... You don't have to look for the right app to uninstall, ... full control over what is being removed from your HD. ...
    (comp.sys.mac.advocacy)
  • Re: Visual Basic for Autorun?
    ... If changes are required they can't be specific to one app. ... Obviously this doesn't apply to all usercontrols and should ... everything is in the one language. ... >I've done it fairly extensively and it works quite well as long as you keep good control over it. ...
    (microsoft.public.vb.general.discussion)
  • Re: Access apps with user definable fields?
    ... New fields would need to added to tables, queries, ... Of course they have their own built in report writer ... > I have an app I built for nonprofits who provide FREE ... > add control switches to control whether certain fields are displayed or ...
    (microsoft.public.access.formscoding)
  • Re: How to get around new limitations on SetForegroundWindow()?
    ... > so far, i.e. external device control. ... > distributed, so the bits are spread out, and among those pieces is an app ... that server program will not ... > recent changes to foreground setting, it will not be able to bring up ...
    (microsoft.public.win32.programmer.ui)