OnSize is likely called as part of the creation of the dialog, at a point where CE_OutputEdit
may not yet have been created. CE_OutputEdit
is created and bound as part of OnInitDialog
. Check the return value of GetDlgItem and only perform whatever you need to do when it returns non NULL.
If needed use a variable that's set to true after you call CDialog::OnInitDialog
and done other necessary initialization. Then use this variable in OnSize
to determine if you should do your processing. Regardless of this, you should still check the return value of GetDlgItem