| 发表于:2007-06-20 10:10:571楼 得分:50 |
//使最小化按钮无效 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); } | | |
|