问个文档/视图结构框架的问题 随便点击一个按钮,让关闭按钮失效点击另外一个按钮,让关闭按钮可用怎么实现?我获得了主窗口框架的指针CWnd* pWnd = AfxGetApp()->GetMainWnd();谢谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //使最小化按钮无效void CMainFrame::OnDisableMinbox() { //获得窗口风格 LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格 style &= ~(WS_MINIMIZEBOX); ::SetWindowLong(m_hWnd,GWL_STYLE,style); //重化窗口边框 CRect rc; GetWindowRect(&rc); ::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME);}//使最大化按钮无效void CMainFrame::OnDisableMaxbox() { //获得窗口风格 LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格 style &= ~(WS_MAXIMIZEBOX); ::SetWindowLong(m_hWnd,GWL_STYLE,style); //重化窗口边框 CRect rc; GetWindowRect(&rc); ::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME);}//使关闭按钮无效void CMainFrame::OnDisableClose() { //获得系统菜单 CMenu *pMenu=GetSystemMenu(FALSE); //获得关闭按钮的ID int x=pMenu->GetMenuItemCount(); UINT pID=pMenu->GetMenuItemID(x-1); //使关闭按钮无效 pMenu->EnableMenuItem(pID, MF_DISABLED);}//使最小化按钮有效void CMainFrame::OnAbleMinbox() { //获得窗口风格 LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格 style |= WS_MINIMIZEBOX; ::SetWindowLong(m_hWnd,GWL_STYLE,style); //重化窗口边框 CRect rc; GetWindowRect(&rc); ::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME); }//使最大化按钮有效void CMainFrame::OnAbleMaxbox() { //获得窗口风格 LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格 style |= WS_MAXIMIZEBOX; ::SetWindowLong(m_hWnd,GWL_STYLE,style); //重化窗口边框 CRect rc; GetWindowRect(&rc); ::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME);}//使关闭按钮有效void CMainFrame::OnAbleClose() { //获得系统菜单 CMenu *pMenu=GetSystemMenu(FALSE); //获得关闭按钮的ID int x=pMenu->GetMenuItemCount(); UINT pID=pMenu->GetMenuItemID(x-1); //使关闭按钮有效 pMenu->EnableMenuItem(pID, MF_ENABLED);} HMODULE和HINSTANCE有什么本质区别? 为什么要用两种句柄类型? 求助:vc2008的msdn可以装在vc6.0上面吗 静态切分视图的大小问题 问一个关于同步方面的简单的问题 各位,请指教!!! 如何判断一个存在的文件是文本还是二进制文件,还请大家多多指教 求教~~十万火急 请教:"struct tagWNDCLASSW "中的 tag 是什么意思? 多个视图类的问题 如何在程序中调用xp的任务管理器?并关闭某进程。 没分了,请帮下忙:使用WTL开发,还能否支持COM? vc2005听说自做测试,VC6.0能么?
//使最小化按钮无效
void CMainFrame::OnDisableMinbox()
{
//获得窗口风格
LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格
style &= ~(WS_MINIMIZEBOX);
::SetWindowLong(m_hWnd,GWL_STYLE,style); //重化窗口边框
CRect rc;
GetWindowRect(&rc);
::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME);
}
//使最大化按钮无效
void CMainFrame::OnDisableMaxbox()
{
//获得窗口风格
LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格
style &= ~(WS_MAXIMIZEBOX);
::SetWindowLong(m_hWnd,GWL_STYLE,style); //重化窗口边框
CRect rc;
GetWindowRect(&rc);
::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME);
}
//使关闭按钮无效
void CMainFrame::OnDisableClose()
{
//获得系统菜单
CMenu *pMenu=GetSystemMenu(FALSE); //获得关闭按钮的ID
int x=pMenu->GetMenuItemCount();
UINT pID=pMenu->GetMenuItemID(x-1); //使关闭按钮无效
pMenu->EnableMenuItem(pID, MF_DISABLED);
}
//使最小化按钮有效
void CMainFrame::OnAbleMinbox()
{
//获得窗口风格
LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格
style |= WS_MINIMIZEBOX;
::SetWindowLong(m_hWnd,GWL_STYLE,style);
//重化窗口边框
CRect rc;
GetWindowRect(&rc);
::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME);
}
//使最大化按钮有效
void CMainFrame::OnAbleMaxbox()
{
//获得窗口风格
LONG style = ::GetWindowLong(m_hWnd,GWL_STYLE); //设置新的风格
style |= WS_MAXIMIZEBOX;
::SetWindowLong(m_hWnd,GWL_STYLE,style); //重化窗口边框
CRect rc;
GetWindowRect(&rc);
::SetWindowPos(m_hWnd,HWND_NOTOPMOST,rc.left,rc.top,rc.Width(),rc.Height(),SWP_DRAWFRAME);
}
//使关闭按钮有效
void CMainFrame::OnAbleClose()
{
//获得系统菜单
CMenu *pMenu=GetSystemMenu(FALSE); //获得关闭按钮的ID
int x=pMenu->GetMenuItemCount();
UINT pID=pMenu->GetMenuItemID(x-1); //使关闭按钮有效
pMenu->EnableMenuItem(pID, MF_ENABLED);
}