How to keep track of dirty controls in a dialog

  atl, c++, data-exchange, dialog, winapi

I was wondering how Windows applications typically keep track of dirty controls in a dialog, so that when the user clicks a button like "Apply" or "Save," the application knows which controls’ values to commit.

I see that edit controls have a EM_GETMODIFY message, which will tell you whether the contents of the edit control have been modified, but I don’t think that type of message is available for other controls like date-time pickers or combo boxes.

So I suspect that this would be done by monitoring change notifications from the controls. But if that’s the case, how might the change events be flagged or stored? I thought that perhaps that whenever a change occurs, the application could store the control’s ID or hwnd in a std::unordered_set, and then iterate through the set when it’s time to commit. Or is there another, more accepted and efficient way? Thank you for any guidance.

Source: Windows Questions C++

LEAVE A COMMENT