(SDK,非MFC)
我在资源那里设计了一个自己的窗口,但我不知道怎样将它显示出来一般那些介绍windows程序入门的书都是这么一个步骤:定义一个窗口类,然后填充这个类的一些属性,接着注册,再就是createwindow,最后显示这个东东.......但我自己的窗口该如何处理,我是想程序一启动就显示我的窗口!

解决方案 »

  1.   

    建立类向导中添加类app 中调用
      

  2.   

    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.Res第二个参数是用MAKEINTERSOURCE宏把对话框资源ID传入即可
      

  3.   

    非模式的就用CreateDialog,和薄荷说的一样的
    然后再BOOL ShowWindow( 
    HWND hWnd, 
    int nCmdShow ); 
    把窗口显示出来模式的对话筐直接用DialogBox()就可以了,参数同CreateDialog把你的这些调用放到
    WinMain中
      

  4.   

    既然可以用CreateDialog创建自己的窗口
    那么前面的 “定义一个窗口类,然后填充这个类的一些属性,接着注册,再就是createwindow,最后显示这个东东.......” 这些东西是必须的吗??我一定要做这些步骤才可以用CreateDialo建立窗口?有捷径吗?
    如果真的要做这些步骤,那么我就糊涂了,本身前面已经用createwindow创建了一个窗口,但这个窗口不是我想要的呢..........我要的是资源里构造的那个啊!我知道我的问题比较愚蠢......但我希望大家可以帮助我,谢谢!
      

  5.   

    这些不是必须的,如果你把窗口当成对话框的话不是必须的,createwindow也是一个办法,但是显示的窗口不是对话框,就像CWnd,而不是CDialog