CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: PostMessage

  1. #1
    Join Date
    Apr 1999
    Posts
    33

    PostMessage

    I am trying to post a message from a modal dialog running in a second thread back to the view window that is its parent in the primary thread. I post the message, but it nevers arrives in the view window. Post message returns success, but with Spy++ I never see it.

    Is there something fatally wrong with this scheme? Why wouldnt this work?

    thanks.



  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: PostMessage

    If the modal dialog disabled the parent, the message queue of the parent is suspended. The message is processed once the modal dialog is closed. Modal dialogs have their own message queue independent of the parent.

    This is how modal dialogs accomplish being modal.

    Regards,

    Paul McKenzie


    Modal dialogs block the parent's message queue. Your message was posted, but the queue is halted until the dialog is closed.


  3. #3
    Join Date
    Apr 1999
    Posts
    33

    Re: PostMessage

    I guess I never thought this out clearly. I've only done what I'm trying to do with modeless dialogs. What your saying makes sense.

    Would a SendMessage work? But not across threads I imagine.

    How do the Toolbar dialogs where you can drag and drop but

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: PostMessage

    I'm not an expert in the way the toolbars work, but I would think that they are really modeless dialogs or just child windows of the%

  5. #5
    Join Date
    Apr 1999
    Posts
    33

    Re: PostMessage

    What I was refering to was the Modal Dialog that comes up where you drag and drop buttons on a tool bar. I am curious to know how that works.

    Anyway I modified my dialog to be modeless, and I now see the message hit my frame window. It never makes it to the view, however.

    I was using ON_MESSAGE() in the view for a message WM_USER+4096. Do you have any idea why this doesnt work? I thought the Main frame would route the message to the view. I have tried sending it direct to the view, but that doesnt help.

    Rich



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured