Home > Software engineering >  Dialog box procedure, add menu bar, cannot maximize the initial setup
Dialog box procedure, add menu bar, cannot maximize the initial setup

Time:03-19

In the dialog box procedure increases the status bar menu bar toolbar
In OnInitDialog function
LoadMenu
SetMenu
Add this menu bar and then maximize ShowWindow (SW_MAXIMIZE); Dialog cannot be covered with a screen, and on the right there is space on the Windows taskbar
As shown in figure



If manual point window to maximize the minimize button is normal
If you remove the menu bar, and maximize the initial normal
New project with the menu bar, the initial maximize is normal (no test status bar that add menu bar toolbar)

Excuse me how should I check

CodePudding user response:

AdjustWindowRectEx

CodePudding user response:

Try to deliver WM_SYSCOMMAND message
 
BOOL CTestDlgDlg: : OnCommand (WPARAM WPARAM, LPARAM LPARAM)
{
If (wParam==IDM_MAXSIZE)
{
PostMessage (WM_SYSCOMMAND, SC_MAXIMIZE, 0);
}
If (wParam==IDM_RESTORE)
{
PostMessage (WM_SYSCOMMAND, SC_RESTORE, 0);
}

Return CDialog: : OnCommand (wParam, lParam);
}



CodePudding user response:

refer to the second floor zgl7903 response:
try delivering WM_SYSCOMMAND message
 
BOOL CTestDlgDlg: : OnCommand (WPARAM WPARAM, LPARAM LPARAM)
{
If (wParam==IDM_MAXSIZE)
{
PostMessage (WM_SYSCOMMAND, SC_MAXIMIZE, 0);
}
If (wParam==IDM_RESTORE)
{
PostMessage (WM_SYSCOMMAND, SC_RESTORE, 0);
}

Return CDialog: : OnCommand (wParam, lParam);
}


The news is a OnSysCommand corresponding function (UINT nID, LPARAM LPARAM)

CodePudding user response:

ShowWindow (SW_MAXIMIZE);
Change
PostMessage (WM_SYSCOMMAND, SC_MAXIMIZE, 0);

The normal
  • Related