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. Get the HWND value of a Dialog

Get the HWND value of a Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 2 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.
  • W Offline
    W Offline
    Willem B
    wrote on last edited by
    #1

    hi, i want to send a message from a thread to my Dialog, but how do i get the HWND value from my dialog? I created the dialog by doing DoModal() thanks in advance, []D [] []D []

    B 1 Reply Last reply
    0
    • W Willem B

      hi, i want to send a message from a thread to my Dialog, but how do i get the HWND value from my dialog? I created the dialog by doing DoModal() thanks in advance, []D [] []D []

      B Offline
      B Offline
      bryce
      wrote on last edited by
      #2

      does GetSafeHwnd() not work? Bryce

      W 1 Reply Last reply
      0
      • B bryce

        does GetSafeHwnd() not work? Bryce

        W Offline
        W Offline
        Willem B
        wrote on last edited by
        #3

        nope, it gives back a NULL value... so i need to get it in another way... i don't even know if the dialog has its own HWND, maybe i need to get it in a different way. []D [] []D []

        B 1 Reply Last reply
        0
        • W Willem B

          nope, it gives back a NULL value... so i need to get it in another way... i don't even know if the dialog has its own HWND, maybe i need to get it in a different way. []D [] []D []

          B Offline
          B Offline
          bryce
          wrote on last edited by
          #4

          lets see...fromthe help files CWnd::GetSafeHwnd HWND GetSafeHwnd( ) const; Return Value Returns the window handle for a window. Returns NULL if the CWnd is not attached to a window or if it is used with a NULL CWnd pointer. are you getting the hwnd before you start the thread? Bryce

          W 1 Reply Last reply
          0
          • B bryce

            lets see...fromthe help files CWnd::GetSafeHwnd HWND GetSafeHwnd( ) const; Return Value Returns the window handle for a window. Returns NULL if the CWnd is not attached to a window or if it is used with a NULL CWnd pointer. are you getting the hwnd before you start the thread? Bryce

            W Offline
            W Offline
            Willem B
            wrote on last edited by
            #5

            Sorry, i got the solution(STUPID STUPID!!!), i wanted to get the HWND value BEFORE i did a DoModal() on my dialog, no wonder it didn't work! Now i set the HWND value of the thread at the OnInitDialog with GetSafeHwnd() and it works fine!:);):):-D:-D thanks for your help! []D [] []D []

            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