Re: CreateDialog and sending a WM_NOTIFY from it

JJ <[email protected]>
Newsgroups alt.comp.os.windows-xp,alt.windows7.general,comp.os.ms-windows.programmer.win32
Organization To protect and to server
Message-ID <[email protected]>
On Thu, 14 Nov 2024 08:54:14 +0100, R.Wieser wrote:
> 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 ?

It's stored within each window itself. Window ID is not a dialog-specific
property. It's a property which exist in all windows. But window ID is
mainly used for controls. It's rarely used for non-parented windows.

> 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

Dialogs use a set of predefined window IDs; at least for OK and Cancel
buttons. Common dialogs use more of them, including controls which are not
buttons. So it's best to avoid using their IDs to avoid disrupting or
unexpectedly triggering the dialog's default behaviour.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.