Read MSDN carefully
John Robbins had warned about this in his debug war stories: read MSDN carefully.
We missed this and ended up with crash.
MSDN says "GetDlgItem() returns pointer which is temporary and should not be saved and used later." Well this remark didn’t catch the eye because we anyway use the pointer in the same method and never save it.
So, naturally, we ignored this and did what it warned against. We got pointer to dialog control. Before using it though, of course in the same method,
we did some calls which invoked COM objects. After this we used the CWnd* pointer to enable the window and !BOOOOM!.. WER flashed.
Invocation of this COM object somewhere deep down has overwritten memory pointed by CWnd* returned by GetDlgItem(). Solution was to call GetDlgItem() and use the pointer immediately.