一个关于系统菜单的小问题。

冰壶2013 2000-11-05 09:04:00
我用ShowWindow使窗口最大化显示后,
想使“还原”按钮和“恢复”菜单失效,
我该怎么做???

还有,我想拜vc高手为师,以mail来“提问、回答”。
哪位肯收我这个徒弟,请EMAIL至:imhua@21cn.com
...全文
206 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
Hidy 2000-11-07
  • 打赏
  • 举报
回复
还有一个更简单实用的方法:

ModifyStyle(WS_MAXIMIZEBOX|WS_MAXIMIZE , NULL);

这样一来[恢复]和[最大化]菜单全变灰,不用处理WM_NCHITTEST,
双击TITLE也不会变小,其中第一参数中有BOX的作用是禁止最大化
按钮,没BOX的作用是防止双击TITLE窗口变小。
这回你应该100%满意了吧,我可费了不少精力的。
Hidy 2000-11-07
  • 打赏
  • 举报
回复
首先:处理消息映射函数WM_NCHITTEST(如果类向导没有,可在类向导选择Class Info,
把其改为Windows),代码如下:
UINT CMainFrame::OnNcHitTest(CPoint point)
{
UINT ret=CFrameWnd::OnNcHitTest(point);
if(ret==HTCAPTION && flag) ret=0;
return ret;
}
其中flag是一个布尔变量,初始值为FALSE,当你最大化窗口时把它设为TRUE。
昨天我刚送出第一分,今天就迎来第一专家分,谢谢!
希望大家一起支持CSDN,一方有?八方解答
冰壶2013 2000-11-07
  • 打赏
  • 举报
回复
Hidy:好!我会给你加分。你的专家分不会再是鸭蛋了。

但我那第三点怎么解决?也就是在标题栏里双击,窗口会变小。怎样使它失效。
Hidy 2000-11-07
  • 打赏
  • 举报
回复
CWnd* pWnd=AfxGetMainWnd();
CMenu* pMenu=pWnd->GetSystemMenu(FALSE);
pMenu->DeleteMenu(SC_RESTORE, MF_BYCOMMAND);

用该方法可以去掉[恢复]菜单,同时[还原]按钮也就失效了。
我也是新手,我的专家分还是个鸡蛋,所以我要拼命......
冰壶2013 2000-11-07
  • 打赏
  • 举报
回复
我不知道怎么解决那三个问题!
SetWindowLong函数怎么用?
dingsg 2000-11-06
  • 打赏
  • 举报
回复
ShowWindow
The ShowWindow function sets the specified window's show state.

BOOL ShowWindow(
HWND hWnd, // handle to window
int nCmdShow // show state
);
Parameters
hWnd
[in] Handle to the window.
nCmdShow
[in] Specifies how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values. Value Meaning
SW_FORCEMINIMIZE Windows 2000: Minimizes a window, even if the thread that owns the window is hung. This flag should only be used when minimizing windows from a different thread.
SW_HIDE Hides the window and activates another window.
SW_MAXIMIZE Maximizes the specified window.
SW_MINIMIZE Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT Sets the show state based on the SW_ value specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.
SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE Displays the window as a minimized window.
This value is similar to SW_SHOWMINIMIZED, except the window is not activated.

SW_SHOWNA Displays the window in its current size and position.
This value is similar to SW_SHOW, except the window is not activated.

SW_SHOWNOACTIVATE Displays a window in its most recent size and position.
This value is similar to SW_SHOWNORMAL, except the window is not actived.

SW_SHOWNORMAL Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.


Return Values
If the window was previously visible, the return value is nonzero.

If the window was previously hidden, the return value is zero.

Remarks
The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter.

As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in the STARTUPINFO structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window. On subsequent calls, the application must call ShowWindow with nCmdShow set to SW_SHOWDEFAULT to use the startup information provided by the program that launched the application. This behavior is designed for the following situations:

Applications create their main window by calling CreateWindow with the WS_VISIBLE flag set.
Applications create their main window by calling CreateWindow with the WS_VISIBLE flag cleared, and later call ShowWindow with the SW_SHOW flag set to make it visible.
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.

dingsg 2000-11-06
  • 打赏
  • 举报
回复


用ShowWindow就可以搞定
dingsg 2000-11-06
  • 打赏
  • 举报
回复


用ShowWindow就可以搞定,
注意参数!
hm_yxd 2000-11-06
  • 打赏
  • 举报
回复
按上面的方法去掉两个属性值后再ShowWidnow不就行了吗!
冰壶2013 2000-11-05
  • 打赏
  • 举报
回复
我按你说的做了,但有不少毛病!
1、WINDOWS的任务栏被挡住了。
2、系统菜单中“移动”菜单项被激活了。
2、在窗口的标题栏里双击,窗口变小,不是全屏幕了。
这些问题怎么解决?
Coolest2k 2000-11-05
  • 打赏
  • 举报
回复
用SetWindowLong,把窗口属性设为:WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME,也就是不加上WS_MAXIMIZEBOX和WS_MINIMIZEBOX就行了。
项目描述 本系统是一套极速开发微信小程序的商城系统,主要包括用户管理、角色管理、部门管理、菜单管 理、定时任务、文件上传、数据权限、Redis 缓存、前后台统一异常处理等系统通用功能,还拥有一套完整的商城后台管理系统、微信小程序源码、小程序接口服务、以及完善的支付流程,极大缩短项目的开发周期。 项目特点 ◆ shop-wechat-mall 采用 Spring、MyBatis、Shiro、swagger 框架开发。 ◆ 灵活的权限控制,可控制到页面或按钮,满足绝大部分的权限需求。 ◆ 完善的部门管理及数据权限,通过注解实现数据权限的控制。 ◆ 支持 MySQL 数据库。◆ 多个团队协作开发,有效降低核心代码泄露。 ◆ 推荐使用阿里云服务器部署本系统项目介绍 shop-admin 后台模块,也是系统的核心,用来开发后台管理系统。 shop-api 接口模块,是小程序商城的接口开发模块。实现了微信用户登录、接口权限认证、获取登录用户、商城首页、专题、分类、 购物车、个人中心等功能,为小程序商城接口的安全调用,提供一套完整的解决方案。 shop-common 公共模块,其他模块以 jar 包的形式引入进去,主要提供些工具类,以 及 shop-admin、shop-api 模块公共的 entity、mapper、dao、service 服务,防止一个功能重复多次编写代码。 shop-framework 系统 web 合并模块,最终项目打包部署模块。最后会介绍为什么会设计此模块,以及设计此模块的意图。 shop-gen 代码生成器模块,只需在数据库里,创建好表结构,就可以生成增、删、改、查等操作的代码,包括 entity、mapper、 dao、service、controller、页面等所有代码,项目开发神器。 shop-schedule 定时任务模块,使用开源框架 quartz 实现分布式定时任务,动态添加、修改、删除、暂停、恢复、立即执行定时任务。 shop-shop 商城后台管理系统,实现了商城的后台管理功能。 wx-mall 商城小程序端源码 开发使用到的软件和工具 Xshell6、Xftp6、Tomcat8.0.33、jdk1.8、MySQL5.7、redis4.0.1 本地部署 ◆ 配置环境(推荐 jdk1.8、maven3.3、tomcat8、mysql5.5+、redis4.0.1) 本机启动 redis 服务、mysql 数据库初始化项目 ◆ 创建数据库 shop-shop,数据库编码为 UTF-8,执行数据库脚本_sql/shop.sql、sys_region.sql、更新脚本.sq ◆ 启动项目之前修改 dev/shop.properties,修改数据库账号和密码,wx.appId、wx.secret、wx.mchId、wx.paySignKey ◆ 修改 j2cache.propertie 配置 redis.hosts 和 redis.password 使用 IDEA 启动项目 配置 tomcat启动成功,访问 http://localhost账号密码:admin/admin Swagger 路径 http://localhost/swagger-ui.html 小程序接口路径 http://localhost/api/ 使用微信 web 开发者工具启动 wx-mall 导入 wx-mall 到微信 web 开发者工具修改 config/api.js 配置开发模式设置     

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧