Click here to Skip to main content
11,709,537 members (50,963 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C++/CLI C MFC ATL WTL STL
When Create controls for a Modless Dialog
Durning which message is it best to do So

OnInitdialog or OnCreate

I meant which virtual functions ??
Posted 1-Aug-09 15:40pm
ForNow2.8K

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

OnCreate is called just when the application requests that the Create function be called. So it is not guarenteed that the window is fully created. OnInitDialog is called after the window (in this case the dialog) is completely created.
When you are dynamically creating a control, you will specify its parent window handle and so it has to be created completely. So always do it in OnInitDialog as said in the previous answer.

  Permalink  
  Print Answers RSS
0 Sergey Alexandrovich Kryukov 590
1 OriginalGriff 250
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,027
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 1 Aug 2009
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100