MFC Dialog: How to add a minimize/maximize button into your dialog?
Q: How to add a minimize/maximize button into your dialog?
A:
- At design time: use the dialogs properties in the resource editor.
- At runtime: override the 'OnCreate()' function like this:
Code:
int CYourDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
SetWindowLong(this->m_hWnd,
GWL_STYLE,
GetWindowLong(this->m_hWnd, GWL_STYLE) | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
return 0;
}
<br><br>