深入分析:怎样从一个对话框弹出单文档视图
数据库编程问题:如何设置一个登陆框,通过登陆框来进入单文档视图。 一般情况下采用的方法大多都是对话框之间的相互切换。但在对话框中添加菜单很多人都特别的陌生。下面我们来介绍一个在对话框中弹出单文档的方法,掌握这个方法之后添加菜单等工作就会容易的很多。 本文中我们将以一个登陆对话框为示例,详细的介绍如何从一个对话框弹出单文档视图。 首先我们需要新建一个对话框资源,以下为一个简单的示例:
注释:初始化程序实例是由InitInstance函数完成的。所以弹出这个对话框的代码也放在这个函数里。 示例代码如下:
注释:请大家注意不是单击OK就可以进入单文档视图,在单击OK后还需要进行检查用户名和密码。所以你必须在对话框的OnOK函数里增加相应的处理代码。
总结:在实际中这些功能还应进行相应的扩充,例如3次登陆失败后就应限制这台电脑在一定时间内不能登陆等,另外还要留意如何验证多个用户名进行登陆等其他相关问题。 |