对话框与普通窗口有啥区别?

icbm 2006-12-07 10:03:37
我的主窗口的窗口处理函数:WndProc,对话框处理函数:DlgProc。

我发现WndProc可以收到WM_KEYDOWN消息,但是DlgProc收不到。

WndProc可以收到WM_GETMINMAXINFO消息,lParam指向一个正确的MINMAXINFO结构;

DlgProc也可以收到WM_GETMINMAXINFO消息,lParam“指向”一个MINMAXINFO结构。但这个结构既不读,也不能写,对它进行读、写操作程序就崩溃了。

我的理解是:对话框也是一个窗口,对话框的“真正的”窗口处理函数由Windows操作系统控制,先做一些预处理。那些没处理的消息,或者经过预处理的消息才发送到由用户定义的对话框处理函数。不知我的理解是否正确。

请问:

对话框与普通窗口有啥区别?

如果情况是我认为的那样,对话框处理函数收到的消息是被Windows系统预处理过的。那么Windows系统做了哪些预处理呢?又有什么结果呢?

欢迎大家指点、讨论。

参与的朋友都有分,分不够可另开帖加分。:)
...全文
1075 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mynamelj 2006-12-07
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/dv_evtuv/html/etconwindowsdialogboxes.asp
xyh2007 2006-12-07
  • 打赏
  • 举报
回复
Windows里面的控件全部是窗口,因为在Win32中创建他们都只用到一个函数CreateWindow或CreateWindowEx,简单到Button,复杂的有ListView,TreeView之类的,只不过类型不同。
一般的窗口是什么反正大家都知道,对话框只是一种特化的窗口,反正Win32 SDK和MFC里面有对它特别的支持。比如说一个特点就是对话框可以是“模态”的,反正它的意思就是,当这个对话框出现时,它的父窗口就不能获得焦点,不能接受键盘和鼠标消息了,一般的对话框都是“模态”的。
一分之千 2006-12-07
  • 打赏
  • 举报
回复
楼主挺爱研究的,对话框不是不能接收键盘消息吧?ALT+F4就可以关闭窗口。
对话框取消了文档视,但是可以加载许多类型的控件,BUTTON,EDIT等是接收键盘输入的,比如MFC中新建的对话框程序,键盘的回车就是响应CDialog::OnOK()--对话框新建的时候默认生成的确定按钮。比如EDIT就需要键盘输入信息等。对其进行封装了是必然的,预处理就是让特定部分响应特定消息吧。建立了不同的社会分工,^_^个人愚见,高手多多指教
happyness44 2006-12-07
  • 打赏
  • 举报
回复

CWnd窗口共性

class CDialog : public CWnd
Remarks
The CDialog class is the base class used for displaying dialog boxes on the screen. Dialog boxes are of two types: modal and modeless. A modal dialog box must be closed by the user before the application continues. A modeless dialog box allows the user to display the dialog box and return to another task without canceling or removing the dialog box.

A CDialog object is a combination of a dialog template and a CDialog-derived class. Use the dialog editor to create the dialog template and store it in a resource, then use the Add Class wizard to create a class derived from CDialog.

A dialog box, like any other window, receives messages from Windows. In a dialog box, you are particularly interested in handling notification messages from the dialog box's controls since that is how the user interacts with your dialog box. Use the Properties window to select which messages you wish to handle and it will add the appropriate message-map entries and message-handler member functions to the class for you. You only need to write application-specific code in the handler member functions.

15,980

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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