Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

that "Double Click" crashes my defenses. Help me.

Status
Not open for further replies.

someTimeOnly

Technical User
Oct 12, 2003
78
0
0
PK

I disabled maximizebox and thickframe in SDI app, to keep client area fixed all the time. But that "Double Click" on title bar somehow gets its way around and causes my window to be of smaller (restore) size. Plus afterward that "Double Click" even doesn't maximize it back.

I'm doing

BOOL CMainFrame::preCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::preCreateWindow(cs) )
return FALSE;

cs.style &= ~WS_MAXIMIZEBOX;
cs.style &= ~WS_THICKFRAME;
...
}
 
Here is one way to do it, although there is probably a better way.

void CTestMFCDlg::OnSize(UINT nType, int cx, int cy)
{
static CPoint pos;
static CSize size;

if(nType != SIZE_MAXIMIZED)
{
size.cx = cx;
size.cy = cy;
RECT rc;
GetWindowRect(&rc);

pos.x = rc.left;
pos.y = rc.top;
CDialog::OnSize(nType, cx, cy);
}
else
{
ShowWindow(SW_SHOWDEFAULT);
SetWindowPos(NULL, pos.x, pos.y, size.cx, size.cy, SWP_NOZORDER);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top