如何在窗口最大化时禁止拖动窗口边框来改变窗口大小 SDI的MainFrame,如何在窗口最大化时禁止拖动窗口边框来改变窗口大小 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 LONG style = ::GetWindowLong(this->m_hWnd,GWL_STYLE); style &= ~(WS_DLGFRAME | WS_THICKFRAME); SetWindowLong(this->m_hWnd,GWL_STYLE, style); this->ShowWindow(SW_SHOWMAXIMIZED); CRect rect; this->GetWindowRect(&rect); ::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,rect.left-1, rect.top-1, rect.right-rect.left + 3, rect.bottom-rect.top + 3, SWP_FRAMECHANGED); 多谢楼上style &= ~(WS_DLGFRAME | WS_THICKFRAME);是可以达到要求。但用了后就出现了新问题我是想最大化时无法拖动边框,但还原后可以拖动,我在还原响应里用了GetWindowLong(..style);style |= WS_DLGFRAME | WS_THICKFRAM;SetWindowLong(..style);发现style无法改回来,边框还是跟最大化一样没了 style |= WS_DLGFRAME | WS_THICKFRAME; SetWindowLong(this->m_hWnd, GWL_STYLE, style); this->ShowWindow(SW_NORMAL); 试过了,重设的Style没起作用,晕了这消息响应是放在CMainFrame下的一个dialogBar里,难道跟这个有关吗?可是为什么style &= ~(WS_DLGFRAME | WS_THICKFRAME);起作用了而 style |= WS_DLGFRAME | WS_THICKFRAME;不起作用呢?代码贴出来给看看:void CShapeDialogBar::OnShapeButtonCommand(CString sShapeName){ if(sShapeName==_T("MAXMIZE")) { CWnd* pParent=GetParent();//取得CMainFrame指针 LONG nStyle=GetWindowLong(pParent->GetSafeHwnd(),GWL_STYLE); if(!m_bMWndMaxed) //BOOL m_bWndMaxed,指示窗口状态 { pParent->GetWindowRect(&m_rcOriMainWnd); CRect rcWorkArea; SystemParametersInfo(SPI_GETWORKAREA,0,&rcWorkArea,0); pParent->MoveWindow(&rcWorkArea); nStyle &= ~( WS_DLGFRAME | WS_THICKFRAME ); } else { pParent->MoveWindow(&m_rcOriMainWnd); pParent->CenterWindow(); nStyle |= WS_DLGFRAME | WS_THICKFRAME ; } SetWindowLong(pParent->GetSafeHwnd(),GWL_STYLE,nStyle); pParent->ShowWindow(SW_NORMAL); m_bMWndMaxed=!m_bMWndMaxed; }} 关于cfiledialog 一个很奇怪的问题 IE的文件菜单-》发送邮件页面,这个功能如何实现? 我想在VC中实现对远程linux服务器的telnet访问,如何实现呢? 利用UDP协议传位图文件,应该怎么传? 请大家指点 模块外包 关于Dao和Oracle的问题 一个找路径的小问题 超强面试 DirectX编程如何获得帧同步信号? 界面拖动问题 如何在机器启动后获取本机的外网IP?
SetWindowLong(this->m_hWnd,GWL_STYLE, style);
this->ShowWindow(SW_SHOWMAXIMIZED);
CRect rect;
this->GetWindowRect(&rect);
::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,rect.left-1, rect.top-1, rect.right-rect.left + 3, rect.bottom-rect.top + 3, SWP_FRAMECHANGED);
style &= ~(WS_DLGFRAME | WS_THICKFRAME);
是可以达到要求。但用了后就出现了新问题
我是想最大化时无法拖动边框,但还原后可以拖动,
我在还原响应里用了
GetWindowLong(..style);
style |= WS_DLGFRAME | WS_THICKFRAM;
SetWindowLong(..style);
发现style无法改回来,边框还是跟最大化一样没了
SetWindowLong(this->m_hWnd, GWL_STYLE, style);
this->ShowWindow(SW_NORMAL);
这消息响应是放在CMainFrame下的一个dialogBar里,难道跟这个有关吗?
可是为什么
style &= ~(WS_DLGFRAME | WS_THICKFRAME);起作用了
而 style |= WS_DLGFRAME | WS_THICKFRAME;不起作用呢?代码贴出来给看看:
void CShapeDialogBar::OnShapeButtonCommand(CString sShapeName)
{
if(sShapeName==_T("MAXMIZE"))
{
CWnd* pParent=GetParent();//取得CMainFrame指针
LONG nStyle=GetWindowLong(pParent->GetSafeHwnd(),GWL_STYLE);
if(!m_bMWndMaxed) //BOOL m_bWndMaxed,指示窗口状态
{
pParent->GetWindowRect(&m_rcOriMainWnd);
CRect rcWorkArea;
SystemParametersInfo(SPI_GETWORKAREA,0,&rcWorkArea,0);
pParent->MoveWindow(&rcWorkArea); nStyle &= ~( WS_DLGFRAME | WS_THICKFRAME );
}
else
{
pParent->MoveWindow(&m_rcOriMainWnd);
pParent->CenterWindow(); nStyle |= WS_DLGFRAME | WS_THICKFRAME ;
}
SetWindowLong(pParent->GetSafeHwnd(),GWL_STYLE,nStyle); pParent->ShowWindow(SW_NORMAL); m_bMWndMaxed=!m_bMWndMaxed; }
}