How to have control always receive messages

  • Thread starter Thread starter Ron Vecchi
  • Start date Start date
R

Ron Vecchi

I am creating a control to mimic the vs.net MainMenu . The control inherits
from control. Is it possible to recieve windows messages when the menu
loses focus. I am running into problems after the tab key is hit, the menu
loses focus and does not respond to messages untill focus is regained. This
is not desireable since hotkeys should open menus.

Also, I would like to stay away from p/invoke for use with linux's mono
project.

Thansk for the help
 
Hi Ron,

Thanks for posting in this group.
I think you should override the Form's WndProc method and intercept certain
message. Then invoke your control.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks for the reply, but is there a way to acheive without adding code to
the form but rather the control itself.
Mabey the control could subscribe itself to an event on the form.

Id like to be able to just add the control to any form without having to add
additional code to each form


Thanks

Ron
 
Hi Ron,

Thanks for your feedback.
Because your control has no focus, windows will dispatch the messages to
your control. So you had to do the dispatch in the Form.
This is the similiar as the windows mouse capture. You can use SetCapture
windows API to force all the mouse message pass to your window, actually,
once this API is called, windows will dispatch the mouse message to your
window.(In this situation, your window is the "control", while windows
system is the "Form").
Hope this make sense to you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top