By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

CWnd and CStatic Based Windows, How to detect mouse leaving the w

P: n/a
Hello,

I am creating a new window class based on CWnd. I am placing it on the View
(CFormView). How can I get the notification or any other indication that
the cursor/mouse is not on this window?

I also tried the same to create a new window based on CStatic but I was not
able to detect when the mouse leaves the window.

Regards,
Eitan
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
>I am creating a new window class based on CWnd. I am placing it on the View
(CFormView). How can I get the notification or any other indication that
the cursor/mouse is not on this window?


Have you tried TrackMouseEvent?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2

P: n/a
Hallo Eitan!
I am creating a new window class based on CWnd. I am placing it on the View (CFormView). How can I get the notification or any other
indication that the cursor/mouse is not on this window?
I also tried the same to create a new window based on CStatic but I

was not able to detect when the mouse leaves the window.
Mouse messages are sent to the parent for CStatic windows. You can
override WM_NCHITTEST and return HTCLIENT. But AFAIK it is enough to set
the style SS_NOTIFY.

You can use TrackMouseEvent to get a message when the cursor leaves the
window.

Also you can get the current position of the cursor and you can compare
it with your window rect.

--
Martin Richter [MVP] WWJD
"In C we had to code our own bugs. In C++ we can inherit them."
FAQ : http://www.mpdvc.de
Samples: http://www.codeguru.com http://www.codeproject.com
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.