Re: how to activate and bring form to the top

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote in message news:op.upt5cdr48jd0ej@xxxxxxxxxxxxxxxxxxxx
On Mon, 23 Feb 2009 18:13:19 -0800, Ajay Kalra <ajaykalra@xxxxxxxxx> wrote:


"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote in message news:op.uptwxx078jd0ej@xxxxxxxxxxxxxxxxxxxx
If by "click on another window" you mean "click on a window owned by a different process", then the answer is "you can't".

By design, a process on Windows is not permitted to force an arbitrary window to the foreground, unless one of a certain narrow list of conditions are met.

Why cant one write a system wide hook to achieve it? Why is it a system limitation?

There are in fact ways around the limitation. But you have to go to some significant trouble to do it.

We have SetWindowsHookEx API for that reason. Thats not a limitation but an explicit API. I am not saying that its a good or bad thing but it can be done by writing a system wide hook.

I have done it(system wide hook) several times and didnt have to meet any list of conditions.

--
Ajay





.



Relevant Pages

  • Re: How to Disable the Desktop
    ... I have to code an application where i need to hook the keyboard. ... I guess you could try subclassing the desktop window and then disable ... But I am not sure of its limitation and whether its a good idea. ...
    (microsoft.public.vc.mfc)
  • Re: using a BHO to capture key strokes from IE alone
    ... So far I understand the limitation, you should be able to create a hook for your IE, but not globally. ... Hema wrote: ... this application i.e. both keyboard hook and CBT thread specific,will ...
    (microsoft.public.dotnet.framework.interop)