Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MouseOut Event 1

Status
Not open for further replies.

LuckyLuke

Programmer
Mar 28, 2001
188
NL
Hi,

Is it possible to detect a MouseOut event without using timers? I don't really know if it's true, but it looks to me, if you have much *mouseout*-buttons, which all use their own timers, it's quite resource eating. Tell me if this is wrong or either another way to do it.

Thanks in advance,

LuCkY
 
LuckyLuke,
I may be wrong on this, but I believe that a MouseOut Event is fired in the OS event queue, but VB does not responde to it. Try hooking into the event queue or subclassing in order to respond to this event. - Jeff Marler B-)
 
Hi,

I looked in the API viewer, but I couldn't find any message that referred to a mouseout event. If you find it, please tell it to me.

LuCkY
 
LuckyLuke,
I checked using Spy++ and no, there is no mouse or mouse in event fired when you enter or leave a window . . . I know that Java has one which is why I thought the event queue would have one . . . now I wonder how the Java virtual machine creates that event . . .
Here is a thought for you though . . . do you remember all of the chatting that was going on a while back regarding hooking into the event queue system wide? Picture this . . . you put together a small C++ Dll that would hook into the system wide queue and monitor mouse move events (which I know exist). On each mouse move event, check the hWnd paramter and if it has not changed, then ignore it. If the hWnd param has changed, then fire a MouseOut event message to the old hWnd event queue and then fire a MouseIn event to the new hWnd event queue. Of course, to do this, you will need to define and register 2 new event queue mesages (MouseIn and MouseOut), but this will probably be a better option than using timer controls.
Just a thought, but it may work. - Jeff Marler B-)
 
Hi,

Thats perfect! If youd do it like this you also don't have to face the next problem to write all that code for all those buttons, because the hWnd to the right button is already been given by the C++ DLL.

Thank you very much,

I'm working on it now ;-)

LuCkY
 
Ok,

the idea is great... BUT, I don't know how to do it :) You could easily say, just write a C++ DLL to monitor all MouseOver events for all objects, but how on earth do I monitor it for all hWnd's? Normally, when you hook something, you hook it to one hWnd right? So how do we I this?

LuCkY
 
When you hook into the Global event queue (which MUST be done in a C++ DLL) you get all events, not just 1 specific hWnd or process. When the event comes in, you will have the Window Handle. - Jeff Marler B-)
 
Already guessed so... I always try in visual basic first :) OK, i'm going to collect all my guts and start that visual C++ program once again...

LuCkY
 
Yeap . . . somethings just can't be done in VB - Jeff Marler B-)
 
I think I've got it, it needs a few more slight adjustments and then I'll post the code ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top