WM_NOTIFY

WM_NOTIFY

Anonymous
Not applicable
771 Views
4 Replies
Message 1 of 5

WM_NOTIFY

Anonymous
Not applicable
For a new project I subclassed an existing dialog procedure (Find dialog), see code below for windproc:

BOOL CALLBACK RegFindDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg) {
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 1005) {
......
}
break;

The QM_NOTIFY message is received normally, but I expected to have the dialog control ID (1005) as a member of NMHDR struct, but when the button with ID 1005 is pressed and released, the procedure does not trap it. In fact, I can make nothing of the codes received with this message.

I checked for the reception of the old 16-bit WM_COMMAND, but it is not there, just the WM_NOTIFY.

Can it be that AutoCAD uses a non standard message coding scheme?

Kind regards
0 Likes
772 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
That button has the WS_EX_NOPARENTNOTIFY extended style set, so it won't
notify its parent. 🙂
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com


wrote in message news:[email protected]...
For a new project I subclassed an existing dialog procedure (Find dialog),
see code below for windproc:

BOOL CALLBACK RegFindDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
lParam)
{
switch(uMsg) {
case WM_NOTIFY:
if (((LPNMHDR)lParam)->idFrom == 1005) {
......
}
break;

The QM_NOTIFY message is received normally, but I expected to have the
dialog control ID (1005) as a member of NMHDR struct, but when the button
with ID 1005 is pressed and released, the procedure does not trap it. In
fact, I can make nothing of the codes received with this message.

I checked for the reception of the old 16-bit WM_COMMAND, but it is not
there, just the WM_NOTIFY.

Can it be that AutoCAD uses a non standard message coding scheme?

Kind regards
0 Likes
Message 3 of 5

Anonymous
Not applicable
From the MSDN documentation:

WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style will not send the WM_PARENTNOTIFY message to its parent window when the child window is created or destroyed.

In short, WS_EX_NOPARENTNOTIFY has nothing to do with a click event

BS_NOTIFY Enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style.

But it does receive a notification when the button is clicked. It's just that the information contained in wParam and lParam is not what I expect it to be.

And this is the resource code of the button being examined:

CONTROL "&Find ", 1005, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 227, 77, 66, 14
0 Likes
Message 4 of 5

Anonymous
Not applicable
It's stranger than I think. Using a message spy, I noticed that the button notifications are actually sent as (old skool) WM_COMMAND messages, not WM_NOTIFY.
The strange part is, they never arrive at my subclassed procedure. I think for some reason AutoCAD sends these messages directly to the original procedure, therein bypassing any other installed procedures.

The only solution would then be to subclass the button procedures as well.....

Other opinions are welcome.
0 Likes
Message 5 of 5

Anonymous
Not applicable
It works, when I hook my windproc with GWL_WNDPROC instead of DWL_DLGPROC. So it behaves like a windows procedure, not like a dialog procedure. It also means I have to provide the subsequent calls to CallWindowProc myself.

I hope this experience will be helpful to someone.
0 Likes