473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Overriding background form activation behavior...

Logan1337
Hi. I'm trying to use a global hotkey via keyboard hooks and a nifty class George Mamladze http://www.codeproject.com/csharp/globalhook.asp (why by the way works and isn't the cause of my problem), but when I try to activate my form from the background, I get mixed behavior of sometimes working as it should, and sometimes resulting in just the taskbar button flashing as apps that require attention do.

As this is a user-initiated action, it does little good to tell them that the application needs attention when they press the hotkey!

Is there a way I can override this "feature" and bring my form to the front 100% of the time?
May 23 '07 #1
2 1018
Found the answer myself!

Seems the trick is to Hide() the form before calling SetForegroundWindow() (User32.dll) and/or Show()/Select() (I'm not sure which are necessarily required as I do all three and it works).

Anyhow this way there is no window to flash in the task bar, so Windows has no choice but to bring up the form when it is Show()n, hee hee.
May 24 '07 #2
kenobewan
4,871 Expert 4TB
Well done! Thanks for sharing the solution :).
May 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: RSH | last post by:
How do I go about overriding a Control's OnPaint Method? I would like to prevent a control's color from changing when it is disabled. I have overridden the Form's OnPaint Method but I need to...
4
by: RSH | last post by:
I tried an implementation of overriding a ComboBox control. I am simply trying to avoid it repainting, but I can't seem to get it to work. What am I doing wrong? Please help. Thanks, Ron
0
by: Wayne Smith | last post by:
I've taken the following code from a developers web site which should allow a user to register and receive an email message with a link to activate their account, but when I click the link on my...
6
by: Doc John | last post by:
Assuming I have several child Forms open (not maximized) in my MDI Form, when I maximize any of them and then close it, all my other Forms automatically maximize. How come? Is there an easy...
8
by: Brian Ward | last post by:
I am looking for a simple way to set the image transparency in a PictureBox. I have a moving PictureBox containing a graphic image .. moving by incrementing its Left property. The background...
4
by: Mufasa | last post by:
I'm going to create a server control in ASP.Net/C# that reacts to a couple of buttons. Thing is - I want to have the functions there for the buttons so if somebody doesn't program the command for...
10
by: r035198x | last post by:
The Object class has five non final methods namely equals, hashCode, toString, clone, and finalize. These were designed to be overridden according to specific general contracts. Other classes that...
0
by: =?Utf-8?B?Sm9obk1TeXJhc29mdA==?= | last post by:
I've got a Windows Forms application. There is a form that may be shown by clicking a command button on either of 2 other forms. I use ShowDialog in all cases to get modal behavior. When the app...
1
by: Alexio | last post by:
I have two similar function that need to be combined. Individually they both work however combined one over rides the other. The code is attached below and an attachment is included for data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.