简体   繁体   中英

How to Make a Simple GUI with DropDown Menus with C++

I am really struggling how to make a window with three selections of options. I currently have a setup that uses a CFileDialog object and have successfully implemented two dropdown menus and multiple check items.

What I want is to implement a pop up window that has the two drop down menus and the check boxes. If a certain item is selected in one of the dropdown menus then the file dialog is opened.

Currently I am trying to make a CWnd object and try to write code for it there.

    CWnd myWindow;

    BOOL VALUE = myWindow.Create(_T("DesktopApp"), _T("test"), WS_VISIBLE | WS_BORDER | WS_CAPTION,
        RECT{ 100,100,400,400 },
        myWindow.GetDesktopWindow(), 12);
    
    myWindow.ShowWindow(SW_SHOWNORMAL);
    

    if (VALUE == FALSE) {
        return 0;
    }

Every time I run this, it prematurely returns ( VALUE == FALSE ). Did I do something wrong? Is there a simpler way to create a window?

The first argument to CWnd::Create is the window class name. A class with the requested name must have been registered before it can be created.

It is common to register an application local class for the application's main window. MFC provides a convenient wrapper function ( AfxRegisterWndClass ) to register a window class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM