Like Tree1Likes
  • 1 Post By _Mike

MessageBox stops program flow

This is a discussion on MessageBox stops program flow within the Windows Programming forums, part of the Platform Specific Boards category; I have two applications. When i send a BM_CLICK message from A to B, it opens a MessageBox on B. ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    790

    MessageBox stops program flow

    I have two applications.
    When i send a BM_CLICK message from A to B, it opens a MessageBox on B.

    My issue is that it stops the program flow in A.
    I have to close the MessageBox on B in order to continue the program flow on A.

    Is this something normal?
    How to avoid this?
    Compiler MSVC++ 2013 with Code::Blocks.

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,203
    Yes. A MessageBox is a modal window, and the returnvalue from the function indicates what button you have pressed to close the messagebox. So this is entirely normal.

    Edit: Did not properly read the question I see, although looks like my information is somewhat related to the issue anyway, but not entirely..
    Last edited by Shakti; 06-20-2011 at 02:45 PM.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    I'm guessing you are using SendMessage()?
    Quote Originally Posted by MSDN
    SendMessage Function
    Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.

    PostMessage Function
    Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.
    Ducky likes this.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    790
    @_Mike
    Yes i was using SendMessage().
    I never would have thought it was that easy, thanks a million, you made my day!

    @Shakti
    Thanks for your response.
    I guess you have learned something too with Mike's answer.
    Compiler MSVC++ 2013 with Code::Blocks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. program stops before EOF
    By doia in forum C Programming
    Replies: 2
    Last Post: 03-22-2010, 12:10 PM
  2. Program flow
    By Ducky in forum C++ Programming
    Replies: 5
    Last Post: 02-11-2010, 11:04 AM
  3. Program flow
    By Ducky in forum C++ Programming
    Replies: 4
    Last Post: 04-20-2009, 08:27 AM
  4. Program stops executing
    By bargomer in forum C++ Programming
    Replies: 16
    Last Post: 04-26-2008, 12:05 PM
  5. Program flow
    By Ducky in forum C++ Programming
    Replies: 22
    Last Post: 01-09-2008, 10:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21