Hi,
Welcome to MSDN Newsgroup!
There are strict rules around when an application can actually activate and
steal focus from whatever the user is currently doing. Besides interrupting
the user's workflow, it can cause serious problems if say a user is
currently typing in a password into a text box, stealing focus is not the
right thing to do.
See the remarks section of SetForegroundWindow
http://msdn.microsoft.com/library/de...us/winui/winui
/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setf
oregroundwindow.asp
The other behavior you are describing (parent application being
minimized/alert form staying minimized) sounds like somehow your alert form
is owned by the parent form? When a window is owned by another window it
will tend to stay in front of the owner window and minimize when the owner
window minimizes.
http://msdn.microsoft.com/library/de...us/dnwui/html/
msdn_styles32.asp
You might consider a notify icon application instead with a toaster window
that pops up alerts when critical things happen.
http://www.windowsforms.net/articles...lications.aspx
Toaster window sample in here
http://www.windowsforms.net/Samples/...mId=198&tabind
ex=4
I hope the above information is helpful for you. If you have any questions,
please feel free to let me know. Thanks and have a nice day!
Best Regards,
Terry Fei [MSFT]
Microsoft Community Support
Get Secure!
www.microsoft.com/security
--------------------
Thread-Topic: Activate minimized form
thread-index: AcYcay4cFRynwxb9Q/CKSlIjy9Mp8w==
X-WBNR-Posting-Host: 208.252.38.111
From: "=?Utf-8?B?RGF2ZSBCb29rZXI=?=" <db******@newsgroup.nospam>
Subject: Activate minimized form
Date: Wed, 18 Jan 2006 12:10:08 -0800
Lines: 9
Message-ID: <5C**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.languages.csharp:379514
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
I have a Windows form application that I generally run minimized. When a
critical event occurs it instantiates another "Alert" form which I want to
grab the user focus.
In the Alert constructor I call both this.Show() and this.Activate(), but
ifthe parent application is minimized then the Alert form will also stay
minimized (and just flash).
How can I cause the Alert form to show itself and grab focus?