Click to See Complete Forum and Search --> : How can I do away with the delay of RButtonDown?
hljn
April 21st, 2002, 09:57 AM
I have added a cion in the tray and programed the WM_RBUTTONDOWN for my icon. But there is still a problem about the mouse right_click.I added three basic functions in popmenu: HideMainWindoW, ShowMianWindow and CloseWindow. When I first ran the program(now the main dialog window has the focus), I clicked my icon in the tray and I found I had to click icon twice before the popmenu appeared. I tested for several time and I found the first click was to make the dialog lost focus and the second click made the popmenu show. So I draw the conclution: when the dialog has the focus the program has to make it lost focus first. How can I deal with this problem? I mean only click right button will show the popmenu whether the dialog has the foucs.
Thanks.
hljn
April 21st, 2002, 09:57 AM
I have added a cion in the tray and programed the WM_RBUTTONDOWN for my icon. But there is still a problem about the mouse right_click.I added three basic functions in popmenu: HideMainWindoW, ShowMianWindow and CloseWindow. When I first ran the program(now the main dialog window has the focus), I clicked my icon in the tray and I found I had to click icon twice before the popmenu appeared. I tested for several time and I found the first click was to make the dialog lost focus and the second click made the popmenu show. So I draw the conclution: when the dialog has the focus the program has to make it lost focus first. How can I deal with this problem? I mean only click right button will show the popmenu whether the dialog has the foucs.
Thanks.
jontom
April 26th, 2002, 04:04 AM
It's a bit of a cheat, but it may be that the first click actually registers in the dialog main window since it has the focus. If you detect it and compare mouse co-ordinates with the icon co-ordinates, then you can repost the message to the icon. Failing that, try detecting the loss of focus for the main dialog window.
Alternatively, when the main dialog window loses focus, presumably the icon is gaining it simultaneously. You could try detecting that and then polling the mouse buttons to see if focus was gained as a result of a right mouse click.
Without actually having some code to run experimentation on, I cannot help more.
Time to change my signature. Hmmm, I wonder what I ought to put...
codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.