Yes i debugged. OnInitDialog() is not called. From where it is supposed to called there dlg.DoModal() is returning -1