Home > MFC > What happens before and after OnInitDialog!

What happens before and after OnInitDialog!

Two functions to look up would be…

  • _AfxPreInitDialog
  • _AfxPostInitDialog

As the name suggests _AfxPreInitDialog gets called before OnInitDialog is called and _AfxPostInitDialog gets called after OnInitDialog.

One of the things that happens in _AfxPostInitDialog is centering of a dialog if user hasn’t changed position of the dialog in OnInitDialog, so how is this done? _AfxPreInitDialog stores co-ordinates of the dialog before OnInitDialog was called and if these co-ordinates hasn’t changed then _AfxPostInitDialog calls CenterWindow MFC function.

All of this is taking place in AfxCallWndProc! WM_INITDIALOG is handled as a special case. Also HandleInitDialog function calls PreInitDialog and OnInitDialog functions!

So have fun looking up these functions!

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: