Giúp dialog lúc load có thể chạy đẹp hơn ^^!
với hàm khởi tạo dialog
Mã:
BOOL CMoveWinDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	//////////////////////////////////////////////////
	CRect dlgRect; 
	GetWindowRect(dlgRect); 
	CRect desktopRect; 
	GetDesktopWindow()->GetWindowRect(desktopRect); 

	MoveWindow((desktopRect.Width() - dlgRect.Width()) / 2, 
		(desktopRect.Height() - dlgRect.Height()) / 2, 
		dlgRect.Width(), dlgRect.Height() ); 

	MoveWindow( (desktopRect.Width() - dlgRect.Width()) / 2, 
		(desktopRect.Height() - dlgRect.Height()) / 2, 
		0, 
		0 ); 
	nWidth=dlgRect.Width(); 
	nHeight=dlgRect.Height(); 
	dx=6; // you can modify this 
	dy=8; // you can modify this 
	::SetTimer(this->m_hWnd, IDT_TIMER3,10 , NULL); 
	// TODO: Add extra initialization here

	return TRUE;  // return TRUE  unless you set the focus to a control
}
để cho việc vén màn dialog diễn ra theo 1 thời gian nhất định ta cần hàm đặt thời gian cho nó


Mã:
void CMoveWinDlg::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default
	CRect dlgRect;
	GetWindowRect(dlgRect);

	CRect desktopRect;
	GetDesktopWindow()->GetWindowRect(desktopRect);

	if(nIDEvent == IDT_TIMER3)
	{	
		MoveWindow(
			(-dx+desktopRect.Width() - dlgRect.Width()) / 2,
			(-dy+desktopRect.Height() - dlgRect.Height()) / 2, 
			+dx+dlgRect.Width(),
			+dy+dlgRect.Height() );

		if(dlgRect.Width() >=nWidth) 
			dx=0; // do not over grow
		if(dlgRect.Height() >=nHeight)
			dy=0; // do not over grow	
	}

	if((dlgRect.Width() >=nWidth) && (dlgRect.Height() >=nHeight))
		::KillTimer(this->m_hWnd, IDT_TIMER3); //Stop the timer	
	CDialog::OnTimer(nIDEvent);
}
Cuối cùng là Project