Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Pure C Dialog Based Application

Pure C Dialog Based Application

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiohelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NullStream
    wrote on last edited by
    #1

    Is it possible to not have a main window as normall proscribed? Basically I would like to use the Dialog builder within Visual Studio to build my "main window." I've tried CreateWindow and CreateDialog all to no avail as they all want parent windows. But unfortunately I want the parent window to be a dialog. Can anyone help me out in this regard? I've read Petzold and have yet to find anything usefull. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion

    T T 2 Replies Last reply
    0
    • N NullStream

      Is it possible to not have a main window as normall proscribed? Basically I would like to use the Dialog builder within Visual Studio to build my "main window." I've tried CreateWindow and CreateDialog all to no avail as they all want parent windows. But unfortunately I want the parent window to be a dialog. Can anyone help me out in this regard? I've read Petzold and have yet to find anything usefull. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion

      T Offline
      T Offline
      Tim Deveaux
      wrote on last edited by
      #2

      Not entirely sure what you're after, but if you use a style of WS_POPUP you won't need a parent. In fact, specifying this style by itself is the way to get a very minimal window happening.

      1 Reply Last reply
      0
      • N NullStream

        Is it possible to not have a main window as normall proscribed? Basically I would like to use the Dialog builder within Visual Studio to build my "main window." I've tried CreateWindow and CreateDialog all to no avail as they all want parent windows. But unfortunately I want the parent window to be a dialog. Can anyone help me out in this regard? I've read Petzold and have yet to find anything usefull. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion

        T Offline
        T Offline
        Todd Smith
        wrote on last edited by
        #3

        Make sure your dialog has the correct properties such as WS_OVERLAPPED. You will need to call RegisterClass before CreateDialog. You'll also need to add IsDialogMessage to your message loop.

        dialog.rc:
        DialogApp DIALOG DISCARDABLE 0, 0, 416, 229
        STYLE WS_OVERLAPPED | WS_MINIMIZEBOX | WS_CAPTION
        CLASS "DialogApp"
        FONT 8, "Times New Roman"
        BEGIN
        PUSHBUTTON "Ok",IDOK,214,191,50,14
        END

        WinMain():

        szAppName = "DialogApp"
        WNDCLASS wndclass;
        wndclass.style = CS_HREDRAW | CS_VREDRAW;
        wndclass.lpfnWndProc = WndProc;
        wndclass.cbClsExtra = 0;
        wndclass.cbWndExtra = DLGWINDOWEXTRA;
        wndclass.hInstance = hInstance;
        wndclass.hIcon = LoadIcon (hInstance, szAppName);
        wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
        wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
        wndclass.lpszMenuName = NULL;
        wndclass.lpszClassName = szAppName;

        if (RegisterClass(&wndclass)==0)
        {
        return 0;
        }

        hwnd = CreateDialog( hInstance, szAppName, 0, NULL);

        while (GetMessage(&msg, NULL, 0, 0))
        {
        if (!IsDialogMessage (hwnd, &msg))
        {
        TranslateMessage (&msg);
        DispatchMessage (&msg);
        }
        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups