怎样将我的对话框show出来

cyberkit 2004-06-11 08:39:37
(SDK,非MFC)
我在资源那里设计了一个自己的窗口,但我不知道怎样将它显示出来

一般那些介绍windows程序入门的书都是这么一个步骤:定义一个窗口类,然后填充这个类的一些属性,接着注册,再就是createwindow,最后显示这个东东.......

但我自己的窗口该如何处理,我是想程序一启动就显示我的窗口!
...全文
104 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
cyberkit 2004-06-12
  • 打赏
  • 举报
回复

我大概知道怎么搞了~~~~高兴!谢谢各位!
bluebohe 2004-06-12
  • 打赏
  • 举报
回复
这些不是必须的,如果你把窗口当成对话框的话不是必须的,createwindow也是一个办法,但是显示的窗口不是对话框,就像CWnd,而不是CDialog

cyberkit 2004-06-12
  • 打赏
  • 举报
回复
既然可以用CreateDialog创建自己的窗口
那么前面的 “定义一个窗口类,然后填充这个类的一些属性,接着注册,再就是createwindow,最后显示这个东东.......” 这些东西是必须的吗??

我一定要做这些步骤才可以用CreateDialo建立窗口?有捷径吗?
如果真的要做这些步骤,那么我就糊涂了,本身前面已经用createwindow创建了一个窗口,但这个窗口不是我想要的呢..........我要的是资源里构造的那个啊!

我知道我的问题比较愚蠢......但我希望大家可以帮助我,谢谢!
handsomerun 2004-06-11
  • 打赏
  • 举报
回复
非模式的就用CreateDialog,和薄荷说的一样的
然后再BOOL ShowWindow(
HWND hWnd,
int nCmdShow );
把窗口显示出来

模式的对话筐直接用DialogBox()就可以了,参数同CreateDialog

把你的这些调用放到
WinMain中
bluebohe 2004-06-11
  • 打赏
  • 举报
回复
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.
Return Values
If the function succeeds, the return value is the handle to the dialog box.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks



第二个参数是用MAKEINTERSOURCE宏把对话框资源ID传入即可
xlz0306 2004-06-11
  • 打赏
  • 举报
回复
建立类向导中添加类

app 中调用
cyberkit 2004-06-11
  • 打赏
  • 举报
回复
其实我是想问,怎样将我的资源跟我的程序关联起来?
Kudeet 2004-06-11
  • 打赏
  • 举报
回复
ShowWindow(_hWnd,nCmdShow);
cyberkit 2004-06-11
  • 打赏
  • 举报
回复
没有人知道吗?急啊~~~~~

16,472

社区成员

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

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

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