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. Assertion From SendNotifyMessage

Assertion From SendNotifyMessage

Scheduled Pinned Locked Moved C / C++ / MFC
c++workspace
14 Posts 3 Posters 3 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 Jochen Arndt

    pParentWnd is NULL or the window has not yet been created (it's HWND member is NULL). I can give no more help because you did not show the relevant code parts (the posted code seems to be MFC source).

    F Offline
    F Offline
    ForNow
    wrote on last edited by
    #4

    The Hwnd is a main Window it is set to a value i'll go into assembly mode and double check

    1 Reply Last reply
    0
    • L Lost User

      Why are you using pParentWnd->GetSafeHwnd() to get your HWND? You should just use GetSafeHwnd() on its own.

      F Offline
      F Offline
      ForNow
      wrote on last edited by
      #5

      thing is I don't know how the code got to dlgcore.cpp The Hwnd is a MainWindow Okay thanks

      L 1 Reply Last reply
      0
      • F ForNow

        thing is I don't know how the code got to dlgcore.cpp The Hwnd is a MainWindow Okay thanks

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #6

        It gets to dlgcore by virtue of your call to SendNotifyMessage, at which point it asserts because the handle you sent it is not valid.

        F 1 Reply Last reply
        0
        • L Lost User

          It gets to dlgcore by virtue of your call to SendNotifyMessage, at which point it asserts because the handle you sent it is not valid.

          F Offline
          F Offline
          ForNow
          wrote on last edited by
          #7

          But the Window Handle is a Main or Mainframe Window I did a FindWindow api call To get the handle As the parent is a C console app and it did work once before I created the modless dialog box in the child process

          L 1 Reply Last reply
          0
          • F ForNow

            But the Window Handle is a Main or Mainframe Window I did a FindWindow api call To get the handle As the parent is a C console app and it did work once before I created the modless dialog box in the child process

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #8

            But you are calling pParentWnd->GetSafeHwnd() in a console app which makes no sense. What does pParentWnd point to?

            F 1 Reply Last reply
            0
            • L Lost User

              But you are calling pParentWnd->GetSafeHwnd() in a console app which makes no sense. What does pParentWnd point to?

              F Offline
              F Offline
              ForNow
              wrote on last edited by
              #9

              Hi I am at work now however the only thing I can think of at this point is that I have to use DuplicateHandle to make the child main window accessible to the parent

              L 1 Reply Last reply
              0
              • F ForNow

                Hi I am at work now however the only thing I can think of at this point is that I have to use DuplicateHandle to make the child main window accessible to the parent

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #10

                No, you just need to find its handle by one of the enumerate functions, or get the child to pass it back in some way. A handle is just a pointer used to identify a Window so you can send messages to it. To be honest, I am not exactly clear about what you are trying to do beyond the basic SendMessage function.

                F 1 Reply Last reply
                0
                • L Lost User

                  No, you just need to find its handle by one of the enumerate functions, or get the child to pass it back in some way. A handle is just a pointer used to identify a Window so you can send messages to it. To be honest, I am not exactly clear about what you are trying to do beyond the basic SendMessage function.

                  F Offline
                  F Offline
                  ForNow
                  wrote on last edited by
                  #11

                  "EnumThreadWindows" My questions in Windows is a threadID unique throughout Windows Thanksp

                  L 1 Reply Last reply
                  0
                  • F ForNow

                    "EnumThreadWindows" My questions in Windows is a threadID unique throughout Windows Thanksp

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #12

                    I would assume yes, since in the case of EnumThreadWindows, the threadid is the only information Windows needs to return the information.

                    F 1 Reply Last reply
                    0
                    • L Lost User

                      I would assume yes, since in the case of EnumThreadWindows, the threadid is the only information Windows needs to return the information.

                      F Offline
                      F Offline
                      ForNow
                      wrote on last edited by
                      #13

                      Richard got the same assertion I believe this has to do with sharing window handles between threads I am going to use duplicate handle and see if that resolves the issue Thanks

                      L 1 Reply Last reply
                      0
                      • F ForNow

                        Richard got the same assertion I believe this has to do with sharing window handles between threads I am going to use duplicate handle and see if that resolves the issue Thanks

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #14

                        ForNow wrote:

                        I believe this has to do with sharing window handles between threads

                        I don't think so. You should be able to send a message to a Window from anywhere.

                        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