Hello all,
Maybe a bit of an esoteric problem, but one I would want to have solved nonetheless:
I've got a program which puts up a settings dialog (using CreateDialog).
From this settings dialog I would like to send notifications (WM_NOTIFY) to its parent.
The problem is, the NMHDR structure expects the "idFrom" field (the control ID) to be filled in, and I can't find it (IDD_SETTINGS, as provided to the CreateDialog call) stored anywhere. :-|
Question:
Is it stored anywhere in the dialog, and if so, where ?
Secondary question:
Will using SetWindowLong with the GWL_ID argument on a Dialog window create any problems (does anything else use that field) ?
Regards,
Rudy Wieser
It's stored within each window itself. Window ID is not a
dialog-specific property. It's a property which exist in all
windows.
Hello all,
Maybe a bit of an esoteric problem, but one I would want to have solved nonetheless:
I've got a program which puts up a settings dialog (using CreateDialog).
From this settings dialog I would like to send notifications (WM_NOTIFY) to its parent.
The problem is, the NMHDR structure expects the "idFrom" field (the control ID) to be filled in, and I can't find it (IDD_SETTINGS, as provided to the CreateDialog call) stored anywhere. :-|
Question:
Is it stored anywhere in the dialog, and if so, where ?
Secondary question:
Will using SetWindowLong with the GWL_ID argument on a Dialog window create any problems (does anything else use that field) ?
The WM_NOTIFY message is for a control on a dialog to send to the dialog.
Not for a dialog to send to its parent.
If your settings dialog is a control on another dialog, it must have
the styles WS_CHILD and DS_CONTROL. Only then can it have a control ID.
If your settings dialog is not a control on another dialog, you are
misusing the WM_NOTIFY message. You will be on your own.
The WM_NOTIFY message is for a control on a dialog to send to the dialog.
Not for a dialog to send to its parent.
Do you have some (preferrably MS origionated) documentation to support that
?
You seem to be right: "Sent by a common control to its parent
window when an event has occurred in the control or the control
requires some kind of information." (MSDN)
I'm not sure I've ever used that message. The only code I
can think of where it appears is with a RichEdit.
The RichEdit sends the WM_NOTIFY to the parent window, as MS says.
Since you haven't explained exactly what you're trying to accomplish, this
is all academic.
I would say I was right,
Woodrow,
The WM_NOTIFY message is for a control on a dialog to send to the dialog.
Not for a dialog to send to its parent.
Do you have some (preferrably MS origionated) documentation to support that
?
The dialog in question is, for all intents and purposes, a child of the dialog that created it (they share the same message-loop).
I Think I explained it in full in my first post: I want/need to get the "window ID" of a(n owned) dialog (the IDD_SETTINGS one that was used as an argument to CreateDialog). Thats all. No more, no less.
So no, there is nothing academic about it ... unless you are trying to "meta problem" the whole thing - which is not something I'm willing to participate in.
Any talk about *the example* of what I currently wanted to use it for is, to me, wasted time. You see, that notification already works (before I posted my question here), even thoughI had to hard-code the "window ID".
...The dialog in question is, for all intents and purposes, a child of the
dialog that created it
In Microsoft's documentation, that is not what what a child window is.
Microsoft's documentation for WM_NOTIFY...
Sent by a common control to its parent window when an event has occurred
or the control requires some information.
Woodrow,
...The dialog in question is, for all intents and purposes, a child of the
dialog that created it
In Microsoft's documentation, that is not what what a child window is.
I know. Why do you think I said "for all intents and purposes" ?
Microsoft's documentation for WM_NOTIFY...
Sent by a common control to its parent window when an event has occurred
or the control requires some information.
Absolutily true.
The problem is that you read that as an exclusion of everything else. I don't.
By the way: I really hate it that MS talks about "windows" regardless of if they are used as controls or ... whats the name for a window thats used to place controls on ? You know, the equivalent of a Dialog. The ambiguity of that word makes it quite hard to be certain what their own documentation is actually talking about. :-(
...The dialog in question is, for all intents and purposes, a child of
the dialog that created it
In Microsoft's documentation, that is not what what a child window is.
I know. Why do you think I said "for all intents and purposes" ?
You gave us intents and purposes for which it is not a child window.
You failed to get a control ID from your dialog. You then failed to
set a control ID on the dialog itself.
You asked me for MS originated documentation. That is what I gave you.
Now you are putting words in my mouth.
I am not responsible for your failures to get or set the control ID which
you wanted.
dialog window *doesn't* seem to have a "window ID" that can be set.
dialog window *doesn't* seem to have a "window ID" that can be set.
GWL_ID Sets a new identifier of the child window. The window cannot be
a top-level window.
The words are clear.
If I would inform the parent or owner of a dialog, I would call a function
of
the object bound to its window handle,
or send or post an own message, a registered one,
or call a given call-back-function.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (3 / 13) |
| Uptime: | 142:33:41 |
| Calls: | 12,089 |
| Calls today: | 2 |
| Files: | 14,998 |
| Messages: | 6,517,452 |