- Close TrackPopup-ed popup menu from background thread
- Posted by Grizlyk on April 27th, 2006
Good day.
I have a popup menu during TrackPopupMenu working in first thread and
have WM_TIMER routine in another thread. How can I close popup menu
from WM_TIMER routine in another thread?
Best regards,
Maxim
- Posted by Alex Fedotov on April 27th, 2006
Grizlyk wrote:
I would try sending WM_CANCELMODE to the window that owns the menu. Not sure
if it works for popup menus though.
-- Alex Fedotov
- Posted by Grizlyk on April 28th, 2006
Good day.
I must describe it more.
The first thread has own message loop. During the loop, DispatchMessage
dispathches posted WM_xxx to own window procedure, and last can call
TrackPopupMenu.
TrackPopupMenu does not return while popup menu is active and
DispatchMessage does not return befor window procedure returns result
of WM_xxx. So i think next step of message loop can't happen befor
DispatchMessage returns result. In other way, TrackPopupMenu makes it's
own message loop and than creates menu popup window.
I have sent WM_CANCELMODE and WM_CLOSE and WM_QUIT messages with
PostThreadMessage to the first thread, nothing happen. Menu popup
window remains alive. I even have called TerminateThread, but nothing
happen.
It is curiouse to me to find out common-used solutions in the trouble.
- Posted by Grizlyk on April 29th, 2006
I have written like this:
static char is_posted=0;
if(is_posted) { is_posted=1; ...} //lost exclamation mark '!'
So TerminateThread is working, but i want to close popup without
TerminateThread.