Q: Where does WM_NCLBUTTONUP go?
Alistair Israel -- aisrael@hotmail.com
Sunday, July 21, 1996
Environment: VC++ 4.1 Win95
Greetings!
I've been trying to get the mouse cursor's current position whenever the user
selects a menu item, with mixed success.
In a single-document interface application, then I have no problem
as I simply handle WM_NCLBUTTONUP msgs in the main frame window,
checking for the HTMENU area as I go... etc.
My problem is when, in a multiple-document interface application,
I try to do the same, it doesn't work. I tried trapping WM_NCLBUTTONUP in the
main frame, in the child frame and (of course
it didn't work) in the view windows. WM_NCLBUTTONUP gets trapped
when the user lets go of the left mouse button in the NC area
*EXCEPT* on the menus and such.
My final solution was to hack into PreTranslateMessage() and trap WM_COMMAND
there (still not a very elegant nor safe solution -- lots
of exceptional cases to handle).
So my question is, where does WM_NCLBUTTON msgs go in an MDI app?
Just curious.
-- Don't ask me why I have to do this, this is actually a friend's
problem.
/******************************
* Alistair Israel *
* (aisrael@hotmail.com) *
* Pilipino Data Network, Inc. *
* http://202.47.133.168 *
******************************/
---------------------------------------------------------
Get Your *Web-Based* Free Email at http://www.hotmail.com
---------------------------------------------------------
Roger Onslow -- Roger_Onslow@compsys.com.au
Thursday, July 25, 1996
>I've been trying to get the mouse cursor's current position whenever the user
>selects a menu item, with mixed success.
Try calling CWnd::GetCurrentMessage(), which returns a pointer to the MSG
structure that contains the message the window is currently processing.
You should only call this in the handler for the message (ie in Onxxxx command
handler for the menu item)
You can then look at the returned MSG pointer
==================================================
The MSG structure has the following form:
typedef struct tagMSG { // msg
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
The MSG structure contains message information from a threads message queue.
Members
hwnd Identifies the window whose window procedure receives the message.
message Specifies the message number.
wParam Specifies additional information about the message. The exact meaning
depends on the value of the message member.
lParam Specifies additional information about the message. The exact meaning
depends on the value of the message member.
time Specifies the time at which the message was posted.
pt Specifies the cursor position, in screen coordinates, when the message was
posted.
==================================================
You can look at the ->pt member to get screen coords
Haven't tried this .. I'll leave it as an exercise for the reader !!!
| Вернуться в корень Архива
|