472,805 Members | 817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

Activate minimized form

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 if
the 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?
Jan 18 '06 #1
2 7822
Try changing the WindowState property of the form to Normal or Maximized.

Dave
Jan 18 '06 #2
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?


Jan 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tai | last post by:
Hi all I have 2 forms, frmMain and frmChild. In frmMain, I declare a variable f as frmChid then Call f.ShowDialog() I want when the child form is minimized, the Main form is also minimized...
2
by: Tai | last post by:
Hi all I have 2 forms, frmMain and frmChild. In frmMain, I declare a variable f as frmChid then Call f.ShowDialog() I want when the child form is minimized, the Main form is also minimized...
1
by: Tai | last post by:
Hi all I have 2 forms, frmMain and frmChild. In frmMain, I declare a variable f as frmChid then Call f.ShowDialog() I want when the child form is minimized, the Main form is also minimized...
0
by: Ole Hanson | last post by:
Hi What's the best way of activating a sleeping process on my local machine? I have an application (.exe) minimized to a notifyicon in the tasktray. Now - if the user clicks the exe-file again...
5
by: Adda | last post by:
In a Parent mdi form I have a datagrid. I select a record from the grid and then invoke a childmdi form. I add the childmdi to an arraylist to keep track of it. If a user has selected multiple...
5
by: vooose | last post by:
Consider a Form with dimension Size=(300,300) that is then minimized. Subsequent calls to Size return (160,24). The Form is then restored and Size returns (300,300) Is there any property or...
6
by: kowndinya | last post by:
Hello All, How to activate my restore button when my (program) window/form is in minimized state through code at a particular time only. I have a timer control on my from. Can i use showwindow...
6
by: =?Utf-8?B?QWxsZW4=?= | last post by:
When minimizing Visual Basic application, working memory is greatly reduced from about 20 MB to only about 2 MB. However I want the application to start as minimized, and most of the time it will...
2
by: =?Utf-8?B?UmljaA==?= | last post by:
using WinXp (SP3), VB2005. sometimes when a user opens the app - the app opens in minimized WindowState and clicking on the app's icon in the windows taskbar wont open the app to Normal...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.