Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My dialog opens with initial size, dialog has a button, If I press it dialog must maximize, and if I press it again, window must assume initial size..
My code:
<pre>
void CDlgEstimateTime::OnBnClickedMaximize()
{
	if (m_bMinMax == false)
	{
		ShowWindow(SW_MAXIMIZE);
		m_bMinMax = true;
	}
	else
	{	
	    this->SetWindowPos(this, 0, 0, m_nWidthInitial, m_nHightInitial, SWP_NOREPOSITION | SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW);
		CenterWindow();
		m_bMinMax = false;	
	}
}




the problem is that: IF I press button window maximizes, I press button again and window assumes initial size, but if I press again window doesn't maximizes but size are fixed

What I have tried:

I tried code that I've written..
Posted
Updated 29-Sep-22 4:57am
v2
Comments
jeron1 29-Sep-22 10:44am    
Do you hit a breakpoint, set in that function, every time you click on that button?

1 solution

I have had success calling
C++
ShowWindow( SW_NORMAL );
to return a window back to its normal position.
 
Share this answer
 
Comments
Member 14594285 29-Sep-22 11:03am    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900