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. CWND from dialog box

CWND from dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
tutoriallearning
6 Posts 4 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.
  • B Offline
    B Offline
    Baatezu
    wrote on last edited by
    #1

    I created a dialog box using the resource editor. I am wondering how to get the CWND from this so I can create controls during run time. Thanks The wisest of the wise may err. - Aeschylus

    D R 2 Replies Last reply
    0
    • B Baatezu

      I created a dialog box using the resource editor. I am wondering how to get the CWND from this so I can create controls during run time. Thanks The wisest of the wise may err. - Aeschylus

      D Offline
      D Offline
      Daniel Strigl
      wrote on last edited by
      #2

      Do you use MFC? If YES, the CDialog class what the Visual C++ Wizard created is derived from CWnd. So, you can use the a member of type CDialog on every place where you can use CWnd. Sample: CMyDialog dlg; dlg.DoModal(); ... **dlg.SetWindowText(_T("Hi!"));** ... **CWnd* pWnd = &dlg;** ... **pWnd->SetWindowText(_T("Hi!"));** Daniel ;) --------------------------- Never change a running system!

      B 1 Reply Last reply
      0
      • D Daniel Strigl

        Do you use MFC? If YES, the CDialog class what the Visual C++ Wizard created is derived from CWnd. So, you can use the a member of type CDialog on every place where you can use CWnd. Sample: CMyDialog dlg; dlg.DoModal(); ... **dlg.SetWindowText(_T("Hi!"));** ... **CWnd* pWnd = &dlg;** ... **pWnd->SetWindowText(_T("Hi!"));** Daniel ;) --------------------------- Never change a running system!

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

        Nope, not using MFC, using the resource editor and the winapi. The wisest of the wise may err. - Aeschylus

        D M 2 Replies Last reply
        0
        • B Baatezu

          I created a dialog box using the resource editor. I am wondering how to get the CWND from this so I can create controls during run time. Thanks The wisest of the wise may err. - Aeschylus

          R Offline
          R Offline
          Rage
          wrote on last edited by
          #4

          If you're running under WIn API, you'll have somewhere in your code a place where you create your main window. This is your CWnd. To add controls in your CDialog, just pass a *CDialog instead of a *CWnd, since CDialog is derived from CWnd (and this, not only in MFC). Finally, if your main win is your dialog, you may pass NULL pointers to create the controls (see MSDN) Hope this helps- ~RaGE();

          1 Reply Last reply
          0
          • B Baatezu

            Nope, not using MFC, using the resource editor and the winapi. The wisest of the wise may err. - Aeschylus

            D Offline
            D Offline
            Daniel Strigl
            wrote on last edited by
            #5

            Oh... than take a look on what Rage wrote ... Daniel ;) --------------------------- Never change a running system!

            1 Reply Last reply
            0
            • B Baatezu

              Nope, not using MFC, using the resource editor and the winapi. The wisest of the wise may err. - Aeschylus

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              You get the HWND of the dialog (not "CWND") as the first parameter to the dialog box function. Also, if the dialog is modeless, its HWND is the return value from CreateDialog(). --Mike-- I'm bored... Episode I bored. 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

              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