怎么在sdk下创建非模式对话框应用程序亚

lastman001 2005-01-19 04:15:30
谢谢
...全文
129 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangyangcheng 2005-01-19
  • 打赏
  • 举报
回复
learning........
koko1998 2005-01-19
  • 打赏
  • 举报
回复
As you've seen, modal dialog boxes are created using DialogBox. The function returns a value only after the dialog box is destroyed. It returns the value specified in the second parameter of the EndDialog call that was used within the dialog box procedure to terminate the dialog box. Modeless dialog boxes are created using CreateDialog. This function takes the same parameters as DialogBox:


hDlgModeless = CreateDialog (hInstance, szTemplate,
hwndParent, DialogProc) ;

The difference is that the CreateDialog function returns immediately with the window handle of the dialog box. Normally, you store this window handle in a global variable.

koko1998 2005-01-19
  • 打赏
  • 举报
回复
再给你个english version

CreateDialog
The CreateDialog macro creates a modeless dialog box from a dialog box template resource. The CreateDialog macro uses the CreateDialogParam function.

HWND CreateDialog(
HINSTANCE hInstance, // handle to module
LPCTSTR lpTemplate, // dialog box template name
HWND hWndParent, // handle to owner window
DLGPROC lpDialogFunc // dialog box procedure
);
Parameters
hInstance
[in] Handle to the module whose executable file contains the dialog box template.
lpTemplate
[in] Specifies the dialog box template. This parameter is either the pointer to a null-terminated character string that specifies the name of the dialog box template or an integer value that specifies the resource identifier of the dialog box template. If the parameter specifies a resource identifier, its high-order word must be zero and its low-order word must contain the identifier. You can use the MAKEINTRESOURCE macro to create this value.
hWndParent
[in] Handle to the window that owns the dialog box.
lpDialogFunc
[in] Pointer to the dialog box procedure. For more information about the dialog box procedure, see DialogProc.
老夏Max 2005-01-19
  • 打赏
  • 举报
回复
直接在WinMain中调用DialogBox显示对话框即可。
老夏Max 2005-01-19
  • 打赏
  • 举报
回复
函数功能:CreateDialog宏从一个对话框模板资源创建一个无模式的对话框,CreateDiaog宏使用CreateDialogParam函数。

函数原型:HWND CreateDialog(HINSTANCE hlnstance,LPCTSTR lpTemplate,HWND hWndParent,DLGPROC IpDialogFunc);

参数:

hlnstance:标识模块事例,该模块的可执行文件含有对话框模板。

pTemplate: 标识对话框模板,此参数或是指向一个以结尾的字符串指针,该字符串指定对话框模板名,或是指定对话框模板的资源标识符的一个整型值。如果此参数指定了一个资源标识符,则它的高位字一定为零,且低位字一定含有标识符,一定用MAKEINTRESOURCE宏来创建此值。

hWndParent: 标识拥有对话框的窗口。

lpDialogFunc: 指向对话框应用程序的指针。有关更多的对话框应用程序的指针,参见DialogProc。

返回值:如果函数调用成功,则返回值为指向对话框的句柄;如果函数调用失败,则返回值为NULL。若想获得更多的错误信息,可调用GetLastError函数。

备注: CreateDialog函数用CreateWindowEx函数来创建对话框。然后CreateDialog函数把一个WM_INITDIALOG消息(如果模板指定DS_SETFONT类型,则加上一个WM_SETFONT消息)传送到对话框应用程序。如果模板指定WS_VISIBLE风格,则函数显示对话框,最后CreateDlalog返回指向对话框的窗口句柄。CreateDialog函数返回之后,应用程序通过Showwindow函数显示对话框(如果还没有显示)。应用程序通过利用DestroyWindow函数来清除对话框。Windows 95和以后版本:系统每个对话框模板可以支持最多达 255个控制。如果要把多于255个控制放入对话框中,必须在WM_INITDIALOG消息处理器中创建控制,而不是把它们放入模板中。Windows CE:IpTempIate参数指向的对话框模板中,DIGTEMPLATE结构并不支持所有类型。

16,472

社区成员

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

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

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