Discussion:
how to use a WM_MOUSEACTIVATE ?
(too old to reply)
Raymond nicolas
2006-11-20 13:22:01 UTC
Permalink
Hello,

I would like to block mouses messages in order to not activate my
application whenever the user click on the client area.

I saw in MSDN database that WM_MOUSEACTIVATE exist but I do not know how to
use it.

somebody please know wether this message could be helpful for me or is there
any other solutions ?

Thanks for your answers.
William DePalo [MVP VC++]
2006-11-20 14:02:45 UTC
Permalink
Post by Raymond nicolas
I would like to block mouses messages in order to not activate my
application whenever the user click on the client area.
This is the kind of question which should be posted in

microsoft.public.win32.programmer.ui
Post by Raymond nicolas
I saw in MSDN database that WM_MOUSEACTIVATE exist but I do not know how to
use it.
somebody please know wether this message could be helpful for me or is there
any other solutions ?
Well in advance of the WM_MOUSEACTIVATE message you will see a WM_NCHITTEST.
If you respond with HTNOWHERE you may be able to get the effect that you
want.

As to the question you asked, you should return MA_NOACTIVATEANDEAT.

Regards,
Will
Raymond nicolas
2006-11-20 17:12:01 UTC
Permalink
thank you for your answer !

I going to precise you what I realy want :

my project needs the application not to be activated when the user click on
it.

I use a mouse Hook to filter mouse messages and try to block them. But this
solution does not filter windows messages such as WM_MOUSEACTIVATE
so I would like to know what is the mechanism of the WM_MOUSEACTIVATE
message and do you think that the mouse hooking is a right solution ?

Thanks for your answer !
William DePalo [MVP VC++]
2006-11-20 21:06:47 UTC
Permalink
Post by Raymond nicolas
thank you for your answer !
You are welcome.
Post by Raymond nicolas
my project needs the application not to be activated when the user click on
it.
OK.
Post by Raymond nicolas
I use a mouse Hook to filter mouse messages and try to block them. But this
solution does not filter windows messages such as WM_MOUSEACTIVATE
so I would like to know what is the mechanism of the WM_MOUSEACTIVATE
message and do you think that the mouse hooking is a right solution ?
As I said, you'll reach more UI experts in the UI group.

Off the top of my head, I'd try to get away without using the hooks, they
are the cause of much evil.

I'd have the in your own application return HT_NOWHERE in response to the
WM_NCHITTEST message. You might have to subclass the common controls that
are the children of your application windows.

And then if you find you still get a mouse activation message, I'd return
MA_NOACTIVATEANDEAT.

But that's just thinking out loud, it's been a while since I've had to do
that. You'll probably find someone with recent experience to share in the UI
group.

Regards,
Will
Raymond nicolas
2006-11-21 09:18:02 UTC
Permalink
Ok thank you for your answer !!

I'll try to do what you said !
Ben Voigt
2006-11-24 16:52:11 UTC
Permalink
Post by Raymond nicolas
thank you for your answer !
my project needs the application not to be activated when the user click on
it.
I use a mouse Hook to filter mouse messages and try to block them. But this
solution does not filter windows messages such as WM_MOUSEACTIVATE
so I would like to know what is the mechanism of the WM_MOUSEACTIVATE
message and do you think that the mouse hooking is a right solution ?
You can do any filtering you want in your message loop between GetMessage
(or PeekMessage) and DispatchMessage.
Post by Raymond nicolas
Thanks for your answer !
Loading...