对话框窗口是指通过CreateDialog,DialogBox 这些API创建的窗口,其中DLGPROC与普通窗口有一些区别。
HWND WINAPI CreateDialog( _In_opt_ HINSTANCE hInstance, _In_ LPCTSTR lpTemplate, _In_opt_ HWND hWndParent, _In_opt_ DLGPROC lpDialogFunc );
MSDN对这种区别有如下解释,消息处理方面流程有所不同,我们创建对话框时传入的窗口过程,不是最终的消息处理函数,而且是供系统的DialogProc调用,切忌在自已的DialogProc中写出 return ::DefWindowProc()这样的代码。
The dialog box procedure is very similar to a window procedure except for the type of return value which is TRUE/FALSE instead of LRESULT. The internal dialog box manager inside Windows IS the true window procedure for the dialog
box. It calls our dialog box procedure with some messages that it received. So the general rule of thumb is that: if our dialog box procedure processes a message,it MUST return TRUE in eax and if it does not process the message, it must return FALSE in eax.
Note that a dialog box procedure doesn't pass the messages it does not process to the DefWindowProc call since it's not a real window procedure.
本文介绍了使用CreateDialog等API创建对话框窗口的方法,并详细解释了对话框窗口过程(DLGPROC)与普通窗口的区别。重点说明了消息处理流程的不同之处,强调在自定义对话框过程函数时的注意事项。
339

被折叠的 条评论
为什么被折叠?



