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. Child dialogs in Win32

Child dialogs in Win32

Scheduled Pinned Locked Moved C / C++ / MFC
designhelplearning
5 Posts 3 Posters 1 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.
  • B Offline
    B Offline
    bluecombtiller
    wrote on last edited by
    #1

    Hey! I'm trying to get a child dialog to show up in a pure Win32 app. What I want to do is use the dialog as half of the UI and use a simple ListBox (created with CreateWindowEx) as the other half. Here's what I'm trying: hCtrls = CreateDialog( hInst, (LPCTSTR)IDD_GAMEINFO, hWnd, (DLGPROC)DlgGameInfo ); The line of code works for all non-child dialogs (like my About and Options dialogs), however as soon as I specify in the resource editor that my IDD_GAMEINFO should be a child it doesn't work. Any help is appreciated! Thanks ./[tiller]

    L A 2 Replies Last reply
    0
    • B bluecombtiller

      Hey! I'm trying to get a child dialog to show up in a pure Win32 app. What I want to do is use the dialog as half of the UI and use a simple ListBox (created with CreateWindowEx) as the other half. Here's what I'm trying: hCtrls = CreateDialog( hInst, (LPCTSTR)IDD_GAMEINFO, hWnd, (DLGPROC)DlgGameInfo ); The line of code works for all non-child dialogs (like my About and Options dialogs), however as soon as I specify in the resource editor that my IDD_GAMEINFO should be a child it doesn't work. Any help is appreciated! Thanks ./[tiller]

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      whats the hWnd ur passing?


      "penguins have no bill"
      biz stuff   about me

      B 1 Reply Last reply
      0
      • L l a u r e n

        whats the hWnd ur passing?


        "penguins have no bill"
        biz stuff   about me

        B Offline
        B Offline
        bluecombtiller
        wrote on last edited by
        #3

        The hWnd is the HWND variable that the main window's WndProc message handler recieves. In the switch statement for the various windows messages I basically have the following to create my UI: case WM_CREATE: HWND hCtrls; // Listbox works hCtrls = CreateWindowEx( WS_EX_CLIENTEDGE, "LISTBOX", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL, 5, 5, 200, 340, hWnd, (HMENU)IDC_GAMELISTBOX, GetModuleHandle(NULL), NULL); // Static frame works hCtrls = CreateWindowEx( WS_EX_CLIENTEDGE, "STATIC", "", WS_CHILD | ~WS_VISIBLE | SS_GRAYFRAME, 210, 5, 250, 340, hWnd, (HMENU)IDC_GAMEINFOFRAME, GetModuleHandle(NULL), NULL); // CreateDialog returns a NULL (IDD_GAMEINFO is my dialog resource) hCtrls = CreateDialog( hInst, (LPCTSTR)IDD_GAMEINFO, hWnd, (DLGPROC)DlgGameInfo ); // I also added this later to try it...but it didn't help: ShowWindow( hCtrls, SW_SHOWNORMAL ); UpdateWindow( hCtrls ); I experimented a bit...the code with no modification works if I specify in the resource editor that the dialog is a regular popup with a border, etc. But of course then it's a popup...and I want it a part of the actually window. (Like a common control would be) Thanks, ./[tiller]

        1 Reply Last reply
        0
        • B bluecombtiller

          Hey! I'm trying to get a child dialog to show up in a pure Win32 app. What I want to do is use the dialog as half of the UI and use a simple ListBox (created with CreateWindowEx) as the other half. Here's what I'm trying: hCtrls = CreateDialog( hInst, (LPCTSTR)IDD_GAMEINFO, hWnd, (DLGPROC)DlgGameInfo ); The line of code works for all non-child dialogs (like my About and Options dialogs), however as soon as I specify in the resource editor that my IDD_GAMEINFO should be a child it doesn't work. Any help is appreciated! Thanks ./[tiller]

          A Offline
          A Offline
          andyj115
          wrote on last edited by
          #4

          Not sure that this is your case, but for child dialogs you have to ensure that the WS_VISIBLE style attribute is set in the resource. :cool:

          B 1 Reply Last reply
          0
          • A andyj115

            Not sure that this is your case, but for child dialogs you have to ensure that the WS_VISIBLE style attribute is set in the resource. :cool:

            B Offline
            B Offline
            bluecombtiller
            wrote on last edited by
            #5

            Yeah...I have WS_VISIBLE selected. ./[tiller]

            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