Re: Windows 2003 server SetForegroundWindow|BringWindowToTop|SetWi

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



Hello,

Thank you for you answer, but just to give you more information, I'm using
Visual .Net C# and into my code I'm using this code:

[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
try
{
SetForegroundWindow(stTempRunningApplication.ProcessInfo.MainWindowHandle);
}
catch(Exception err)
{
MessageBox.Show(err.Message);
}

And I see the exception with any Window form not only with mine, for example
notepad.exe, calc.exe

I hope that I give you more information to help me.

BR
Laurent



"Joseph M. Newcomer" wrote:

An exception sounds surprising; none of those APIs are specified as throwing an exception.
You would have to show some code to explain what is going on here.

The discussion of SetForegroundWindow does suggest that there are certain limitations. For
example, a process can only set the foreground window if it is already the foreground
process (e.g., it can cause one of its own windows to yield foregroundness), or it is a
process started by the foreground process, or if there is no current foreground process.
There are a few other conditions. You have not stated the entire problem; for example,
is it one of your windows for which you are trying to set the foreground property?

Perhaps privileges affect this, but without a complete specification of the problem, it is
hard for anyone to test what your situation is.
joe

On Thu, 9 Feb 2006 01:07:27 -0800, "Lolo" <Lolo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hi all,

I'm trying to use this functions
(SetForegroundWindow|BringWindowToTop|SetWindowPos) on Windows 2003 server,
but it is working when I have a Administrator level and when I try the
sameprogam with the operator level I have an exception like <Impossible to
run this information from the remote pc>.
I tryed the same program on Window XP with the operator level and it is
working.

Somebody knows why ?

I'm looking forward to receiving an answer soon possible.

BR
lolo
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

.



Relevant Pages

  • Re: Windows 2003 server SetForegroundWindow|BringWindowToTop|SetWindow
    ... An exception sounds surprising; none of those APIs are specified as throwing an exception. ... a process can only set the foreground window if it is already the foreground ... is it one of your windows for which you are trying to set the foreground property? ... I tryed the same program on Window XP with the operator level and it is ...
    (microsoft.public.vc.mfc)
  • Re: Bizarre background window behavior in Word
    ... while one of the inactive open documents will randomly move to ... the inactive window now in the foreground ... the active window that is now hidden in the background. ... McGhie Information Engineering Pty Ltd ...
    (microsoft.public.mac.office.word)
  • Re: BringWindowToFront/SetForegroundWindow problem
    ... full-screen window and pushing it to the bottom before trying to bring up the previous app. ... means you no longer have the foreground window status, and thus lose some ability to bring another ... the message loop has activated to handle the Registered Window Message. ...
    (microsoft.public.vc.mfc)
  • Re: Time Machine Bug or Feature?
    ... With Safari in the foreground and Skype in the backgound I called my Skype ... background apps can definitely put up a window in front of everything ...
    (comp.sys.mac.system)
  • Re: Bizarre background window behavior in Word
    ... Snow Leopard. ... while one of the inactive open documents will randomly move to ... the inactive window now in the foreground ... the active window that is now hidden in the background. ...
    (microsoft.public.mac.office.word)