473,388 Members | 1,207 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,388 software developers and data experts.

C# app - mouseleave event not firing when another window is in the foreground

Hello all!

I'm working on a C# app that changes the background color of the form on mouseenter then changes it back to the original on mouseleave. For the most part this has been working pretty well, but it seems as though the mouseleave event never fires if I leave the form by way of mouseover'ing another app window.

I've seen this problem mentioned before but I haven't seen a solution. Has anyone come across this before? Any super not-so-secret Windows API hooks that I can use perhaps?

Thanks for reading.

-S.
Mar 11 '08 #1
4 4959
Plater
7,872 Expert 4TB
Well I guess first off, when the mouse moves over the other window is it still in the "area" of the whatever you are watching and waiting for a mouse out?
Which window is active durring these situations? (Or does it happen regardless of which window has focus?)
Can you also use the various lost focus events?
Mar 11 '08 #2
Well I guess first off, when the mouse moves over the other window is it still in the "area" of the whatever you are watching and waiting for a mouse out?
Nope, I'm checking for that. It's almost as if the mouseleave event never gets fired when the mouse moves from my application in the background to an overlapping foreground window.

Which window is active durring these situations? (Or does it happen regardless of which window has focus?)
It only happens when my app is in the background and any other window is overlapping a part of it.

Can you also use the various lost focus events?
I tried that, but the app never has focus, really, so those don't work.

I'm still at a loss :( I tried overriding WndProc() waiting for the WM_NCMOUSELEAVE and WM_MOUSELEAVE messages, but those don't get fired either.

-S.
Mar 14 '08 #3
Plater
7,872 Expert 4TB
What you could maybe do is set up some global hooks.
That will give you mouse/keyboard events even when your window does not have focus. You would have to do some smarts to decide when the mouse is/isn't over your window, but I think it's doable.
Mar 14 '08 #4
What you could maybe do is set up some global hooks.
That will give you mouse/keyboard events even when your window does not have focus. You would have to do some smarts to decide when the mouse is/isn't over your window, but I think it's doable.
That's great! It looks like exactly what I need. I'll take a look.

Thanks for the link!

-S.
Mar 14 '08 #5

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

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
0
by: Machi | last post by:
I am using C#.NET. API version showintaskbar form Window taskbar hide show not fire events MouseLeave and MouseEnter! Now i am facing a critical problem for MouseLeave and MouseEnter event when i...
6
by: Able | last post by:
Dear friends I have some drawing commands in the Form1_paint event. It works pretty well. The drawing gets redrawn when the window is resized. It gets redrawn after I minizie the window and...
0
by: Pucara | last post by:
Hi all, I have noticed that the picturebox object doesnt' fire correctly the mouseEnter mouseLeave events. The problem is seen ONLY when you show a form more than once. You can reproduce it...
8
by: Bob | last post by:
I completely disagree with MS's decision to make you buy a whole new version of their product to get a fix to such a basic, glaring, long-standing bug. I deployed an entire ERP system written in...
1
by: Huahe | last post by:
Hi, I have an checkedlistbox with a lot of items, so there is a vertical scrollbar in the checkedlistbox. I want to make the checkedlistbox invisible when the mouseleave event goes off. The...
10
by: fusillo | last post by:
Hi, i've tried a test code about the Event Listener API but i've some problem about detaching the element firing the event with IE. Here's my code: <html> <head> <style type="text/css">...
17
by: Bodyboarder20 | last post by:
Hello! So im working on an applicaiton that all pretty much sits on a single form. When the application completes a task, I'd like it to use FlashWindow() to notify the user that it has...
3
by: rory.groves | last post by:
I have an C# .NET 2.0 application which runs fine on XP, but on Vista (Home Basic), the MouseUp event does not fire until i move the mouse over another control/button in the application. The same...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.