I.Fer
I.Fer

Reputation: 3

How to intercept the WM_SIZE message coming from my CDialog

I'm trying to intercept the size and position change of my CDialog based window using C++ with MFC framework (VS 6.0), in order to adapt the positions of my composants according to the new size and/or position.

How can I do this ?

Thank you !

Upvotes: 0

Views: 451

Answers (1)

Joseph Willcoxson
Joseph Willcoxson

Reputation: 6040

1) In the message map of your dialog, add an ON_WM_SIZE() macro

2) In your dialog, add the following message handler:

void CYourDerivedDlg::OnSize(UINT nType, int cx, int cy)
{
   CDialog::OnSize(nType, cx, cy);
   // do whatever else you need
}

Upvotes: 2

Related Questions