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. how we can convert CWnd* to HWND

how we can convert CWnd* to HWND

Scheduled Pinned Locked Moved C / C++ / MFC
9 Posts 7 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.
  • J Offline
    J Offline
    johnalek
    wrote on last edited by
    #1

    plz send me #sankar#

    C A V H A 5 Replies Last reply
    0
    • J johnalek

      plz send me #sankar#

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Use GetSafeHwnd[^]


      Cédric Moonen Software developer
      Charting control

      1 Reply Last reply
      0
      • J johnalek

        plz send me #sankar#

        V Offline
        V Offline
        Viorel
        wrote on last edited by
        #3

        Try this:

        CWnd * wnd = ....;
        HWND hwnd = *wnd;
        // or
        HWND hwnd = wnd->m_hWnd;
        
        R 1 Reply Last reply
        0
        • J johnalek

          plz send me #sankar#

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

          CWnd* pMyCwnd = new CWnd(); pMyCwnd->m_hWnd // This is the HWND of CWnd class Too many plans make the health badly!!

          J 1 Reply Last reply
          0
          • A AkiraOne

            CWnd* pMyCwnd = new CWnd(); pMyCwnd->m_hWnd // This is the HWND of CWnd class Too many plans make the health badly!!

            J Offline
            J Offline
            johnalek
            wrote on last edited by
            #5

            Thanque #sankar#

            1 Reply Last reply
            0
            • J johnalek

              plz send me #sankar#

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              you can use if you have a CWnd from m_hWnd --------------- HWND hWnd=this->m_hWnd;_**


              **_

              whitesky


              1 Reply Last reply
              0
              • V Viorel

                Try this:

                CWnd * wnd = ....;
                HWND hwnd = *wnd;
                // or
                HWND hwnd = wnd->m_hWnd;
                
                R Offline
                R Offline
                Rage
                wrote on last edited by
                #7

                Viorel. wrote:

                HWND hwnd = *wnd

                Does this really work ? Never seen it before... ~RaGE();

                I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus

                V 1 Reply Last reply
                0
                • R Rage

                  Viorel. wrote:

                  HWND hwnd = *wnd

                  Does this really work ? Never seen it before... ~RaGE();

                  I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus

                  V Offline
                  V Offline
                  Viorel
                  wrote on last edited by
                  #8

                  Rage wrote:

                  Does this really work?

                  Yes, it works thanks to a cast operator within CWnd: "operator HWND() const;".

                  1 Reply Last reply
                  0
                  • J johnalek

                    plz send me #sankar#

                    A Offline
                    A Offline
                    Alton Williams
                    wrote on last edited by
                    #9

                    Or you do this

                    CWnd *pWnd // whatever window your pointing to
                    HWND MyHandle = (HWND) pWnd
                    
                    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